Skip to content

Instantly share code, notes, and snippets.

Created September 29, 2021 19:10
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Nifi Expression Language Tester
// usage: groovy nifi-test-el.groovy '${now():toNumber():minus(3999900000):format("yyyy-MM-dd HH:mm:ss", "GMT")}'
// source:
@Grab(group='org.apache.nifi', module='nifi-expression-language', version='1.4.0')
import org.apache.nifi.attribute.expression.language.*
def cli = new CliBuilder(usage:'groovy testEL.groovy [options] [expressions]',
header:'Options:')'print this message')
cli.D(args:2, valueSeparator:'=', argName:'attribute=value',
'set value for given attribute')
def options = cli.parse(args)
if(!options.arguments()) {
return 1
def attrMap = [:]
def currKey = null
options.Ds?.eachWithIndex {o,i ->
if(i%2==0) {
currKey = o
} else {
attrMap[currKey] = o
options.arguments()?.each {
def q = Query.compile(it)
println q.evaluate(attrMap ?: null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment