Created 06-29-2017 08:39 AM
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.
Created 06-29-2017 06:54 PM
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.
Created 06-29-2017 12:05 PM
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.
Created 06-29-2017 06:54 PM
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.