Variable FlowFile Attributes Defined by FlowFile Content

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Variable FlowFile Attributes Defined by FlowFile Content

dale.chang13
I see that the ExtractText Processor performs regular expressions on the FlowFile's content and adds the results as user-defined attributes. However, I was wondering if there was a way to avoid "hard-coding" these values. I was hoping of something along the lines where the key literal of the FlowFile attributes were defined in the FlowFile content.
Reply | Threaded
Open this post in threaded view
|

Re: Variable FlowFile Attributes Defined by FlowFile Content

Matt Burgess
This is an interesting idea, can you elaborate on what such a file would
look like and how it would be used? Would it contain values to be used as
attributes in ExtractText as well as the content from which to extract the
values for these attributes?

In general, I don't believe a property name can be defined dynamically
(Expression Language, e.g.) for processors like ExtractText, but NiFi
0.5.0+ has ExecuteScript and InvokeScriptedProcessor, both of which offer
quite a bit of flexibility in these areas.

Regards,
Matt

On Thu, Mar 31, 2016 at 12:35 PM, dale.chang13 <[hidden email]>
wrote:

> I see that the ExtractText Processor performs regular expressions on the
> FlowFile's content and adds the results as user-defined attributes.
> However,
> I was wondering if there was a way to avoid "hard-coding" these values. I
> was hoping of something along the lines where the key literal of the
> FlowFile attributes were defined in the FlowFile content.
>
>
>
> --
> View this message in context:
> http://apache-nifi-developer-list.39713.n7.nabble.com/Variable-FlowFile-Attributes-Defined-by-FlowFile-Content-tp8682.html
> Sent from the Apache NiFi Developer List mailing list archive at
> Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Variable FlowFile Attributes Defined by FlowFile Content

dale.chang13
Essentially all of the information contained in a FlowFile's contents would be translated to attributes. I would like to pass in a generic delimited file with two rows:
- the first row contains header names,
- the second row contains values for each header corresponding to a single entry.

The use-case would take the header names as FlowFile keys, and the following line's values as values to the FlowFile keys.

I will probably use ExecuteProcess or ExecuteStreamCommand if no built-in functionality exists



Matt Burgess wrote
This is an interesting idea, can you elaborate on what such a file would
look like and how it would be used? Would it contain values to be used as
attributes in ExtractText as well as the content from which to extract the
values for these attributes?

In general, I don't believe a property name can be defined dynamically
(Expression Language, e.g.) for processors like ExtractText, but NiFi
0.5.0+ has ExecuteScript and InvokeScriptedProcessor, both of which offer
quite a bit of flexibility in these areas.

Regards,
Matt