Get all available variables in the InvokeScriptedProcessor

2020-08-07 Thread Saloni Udani
Hi, We use NiFi 1.5.0. Our use case is to get particular key pattern variables (key and value) in the groovy InvokeScriptedProcessor. E.g I want all variables whose key starts with "a.b.c". By this I can write a generic logic on certain categories of variables for further use. Is there a way progr

Re: Get all available variables in the InvokeScriptedProcessor

2020-08-07 Thread Andy LoPresto
I think we need additional clarification on what you mean by “variables”. If you are referring to actual Groovy variables, you can enumerate them using the binding available in the context (see below). If you mean the attributes available on a flowfile, you can access them similarly. Find all

Re: Get all available variables in the InvokeScriptedProcessor

2020-08-10 Thread Andy LoPresto
Those variables are available to be referenced via Expression Language in the flowfile attributes. They are not intended for direct programmatic access via code, so you don’t need to address them directly in your Groovy code. If you need to populate specific values at configuration time, you ca

Re: Get all available variables in the InvokeScriptedProcessor

2020-08-10 Thread Saloni Udani
Thanks Andy, but with expression language I can only get values of attributes and not both key and value. In our case , variable key also has some useful information. Thanks On Mon, Aug 10, 2020 at 10:32 PM Andy LoPresto wrote: > Those variables are available to be referenced via Expression Lan

Re: Get all available variables in the InvokeScriptedProcessor

2020-08-11 Thread Matt Burgess
Although this is an "unnatural" use of Groovy (and a conversation much better suited for the dev list :), it is possible to get at a map of defined variables (key and value). This counts on particular implementations of the API and that there is no SecurityManager installed in the JVM so Groovy ign

Re: Get all available variables in the InvokeScriptedProcessor

2020-08-12 Thread Saloni Udani
Thanks Matt. Seems like what I am trying to achieve is an antipattern. On Wed, Aug 12, 2020 at 12:59 AM Matt Burgess wrote: > Although this is an "unnatural" use of Groovy (and a conversation much > better suited for the dev list :), it is possible to get at a map of > defined variables (key and