You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Alessio Palma <al...@buongiorno.com> on 2016/10/18 13:14:18 UTC

Flow file from a (long) string

Hello, is there a processor which allows to build a flowfile from a string?
Basically I have some huge queries and want to add them into the
workflow without load them from file or database.

AP


Re: Flow file from a (long) string

Posted by Joe Percivall <jo...@yahoo.com>.
Hello AP,

The way this is generally done is a GenerateFlowFile processor -> ReplaceText. For ReplaceText, you will use the "Replace Strategy" of "Always Replace" and an "Evaluation Mode" of "Entire Text". This will set the content of the FlowFile to whatever you have in the "Replacement Value" field.

 

Joe
- - - - - - 
Joseph Percivall
linkedin.com/in/Percivall
e: joepercivall@yahoo.com



On Tuesday, October 18, 2016 9:14 AM, Alessio Palma <al...@buongiorno.com> wrote:



Hello, is there a processor which allows to build a flowfile from a string?
Basically I have some huge queries and want to add them into the
workflow without load them from file or database.

AP

Re: Flow file from a (long) string

Posted by Matt Burgess <ma...@gmail.com>.
Alessio,

The ReplaceText processor [1] will allow you to set the content of a
flow file to a string of your choosing. You can use GenerateFlowFile
[2] with a size of 0B and type Text, to get a flow file routed to
ReplaceText, which then sets the content. This is a common pattern
seen in some of the example templates [3].

Alternatively, I have a one-processor template [4] that uses
InvokeScriptedProcessor [5] and Groovy, and lets you generate flow
file(s) where you can set the content and filename via processor
properties.

I couldn't find a Jira case (but feel free to write one) to add the
ability to set the content of the flow file directly in
GenerateFlowFile, which would allow you to skip the ReplaceText
processor.

Regards,
Matt

[1] https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.ReplaceText/index.html
[2] https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.GenerateFlowFile/index.html
[3] https://cwiki.apache.org/confluence/display/NIFI/Example+Dataflow+Templates
[4] https://gist.github.com/mattyb149/0c87a1a6f1d98a43c8d0
[5] https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.script.InvokeScriptedProcessor/index.html

On Tue, Oct 18, 2016 at 9:14 AM, Alessio Palma
<al...@buongiorno.com> wrote:
> Hello, is there a processor which allows to build a flowfile from a string?
> Basically I have some huge queries and want to add them into the
> workflow without load them from file or database.
>
> AP
>