我想使用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)
}