Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to pass command line arguments in executescript processor in NIFI

avatar
Explorer

Dear all, I have written user defined functions in Python / jython and executing them using executescript processor in Nifi. Till now everything went fine. Now in one my script I need to pass command line arguments to my scripts. Please tell me way to pass command line arguments for jython scripts. And also I would like know is there way to access property attributes from Nifi processor in my jython script in execute processor.

1 ACCEPTED SOLUTION

avatar
Master Guru

In addition to @Wynner's answer, if you'd like to keep using ExecuteScript, you can pass in arguments as user-defined properties (aka dynamic properties) or flow file attributes and use them in ExecuteScript. For examples on leveraging user-defined properties in ExecuteScript, check out Part 3 of my ExecuteScript Cookbook article series in HCC, it has examples in Jython.

View solution in original post

2 REPLIES 2

avatar

@shivanand khobanna

The ExecuteStreamCommand processor should be able to do what you need to do.

You can access the attributes using the expression language. For instance if you have an attribute named jython1, using ${jython1} will return the value of that attribute and you can use as a parameter when calling your script.

avatar
Master Guru

In addition to @Wynner's answer, if you'd like to keep using ExecuteScript, you can pass in arguments as user-defined properties (aka dynamic properties) or flow file attributes and use them in ExecuteScript. For examples on leveraging user-defined properties in ExecuteScript, check out Part 3 of my ExecuteScript Cookbook article series in HCC, it has examples in Jython.