如何使用Nifi中的Execute groovy脚本处理器访问多个DBCP控制器服务以查询多个SQL数据库?

时间:2019-09-12 04:38:37

标签: groovy apache-nifi

我想使用groovy脚本从ExecuteGroovyScript Processor中查询多个数据库。

我已经设置了多个DBCP连接池,并通过groovy代码使用NIfi中的LookUp服务来访问它们。

import java.time.*

import groovy.sql.Sql

def flowFile = session.get()
if(!flowFile) return

try {


//def customerName = flowFile."database_name"
def indextDb = SQL.indexing
String request_id = ""
String customer_name = ""
String start_date = ""
String end_date = ""

// code to access lookup service and get database connection as per 
result
} catch (Exception e) {
    log.warn("${e.message}")
    session.transfer(flowFile, REL_FAILURE)
}

0 个答案:

没有答案