Hi,

processor ReplaceText (.*) with ${yourattribute} - replaces FF content with
expression  (example 1 attribute)
But looking into ExecuteScript documentation
https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-scripting-nar/1.5.0/org.apache.nifi.processors.script.ExecuteScript/index.html
Seems only "Script File" and "Module Directory" supports Expression
Language: true (aka use of attributes etc).
Sadly "Script Body" doesnt support  Expression Language, meaning you cant
load script body from ${yourattribute}.

You may try the workaround of saving script as local file and then set both
directory + script file dynamically as they support expression.

Hope this helps,
Emanuel O.




Best Regards,
*Emanuel Oliveira*



On Wed, Feb 5, 2020 at 7:15 PM Anurag Sharma <[email protected]>
wrote:

> Hi,
>
>
> We are trying to create a generic data flow where configuration will be
> received as JSON. Configuration will have a JavaScript to be executed.
>
>
>
> We are stuck on how to execute the script we received in configuration, as
> the ExecuteScript processor needs either scriptPath or scriptBody. But in
> our case script will be in flowFile's attribute.
>
>
>
> What are all possible ways to achieve this functionality?
>
>
>
> Along with this, the script should not be able to access the 'session' and
> 'context' variables available in the ExecuteScript processor. So how to
> sanitise the script before execution?
>
>
> Regards
>
> Anurag
>

Reply via email to