I need a help, I am new to NiFi. I am using python script. I wanted to add output stream relationship result of ExecuteStreamCommand processor into original flow file. In original file I am getting body and the script is generating users information. Please help me
- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
how to add output stream relationship result of Execute Stream Command processor into original flow file
- Labels:
-
Apache NiFi
Created ‎06-14-2022 05:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created ‎06-14-2022 10:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
first you need to check if there is an attribute called filename on the original flowfile and its the same passed the output stream flowfile. If there is, then you should specify it as "filename" in the merge content property and NOT as "${filename}".
Created ‎06-14-2022 05:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Techie123
The ExecuteStreamCommand processor is working as designed:
https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.16.2/org.apach...
Executes an external command on the contents of a flow file, and creates a new flow file with the results of the command.
You could route both the "original" and "output stream " relationships via the same outbound connection to a mergeContent processor which can merge the content from both source FlowFiles into a single FlowFile.
https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.16.2/org.apach...
If you found this response assisted with your query, please take a moment to login and click on "Accept as Solution" below this post.
Thank you,
Matt
Created ‎06-14-2022 06:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes. But the thing is script is generating token decryption result and original flow file contains body. But the merge content processor is merging flow files randomly
Created ‎06-14-2022 06:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@MattWho , can we append output stream result to original flow file without using mergeContent processor because the we have multiple incoming flow files and i just wanted to append two at a time, original flow file with the output stream result
Created on ‎06-14-2022 06:59 AM - edited ‎06-14-2022 07:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a unique attribute on the original flowfile (like filename) that gets set on the output stream ? if so, you can set the mergeContent processor property "Correlation Attribute Name" to the attribute containing the unique value that is shared between original and output, this way you guarantee that only related original and output are getting merged.
Created ‎06-14-2022 07:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@SAMSAL , thanks for quick response. But I am new to nifi, can you please explain it a bit. you want me to add the filename explicitly? and then merged these flow files?
Created ‎06-14-2022 07:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
how is the original flowfile is generated. usually you should have filename attribute set by default on the original flowfile. this should be unique for the flowfile and this filename could be passed to the output stream, can you check that?
Created ‎06-14-2022 08:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @SAMSAL , I am doing the same but still not getting the desired output.
Can you refer snapshot, Am i missing something?
Created ‎06-14-2022 10:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
first you need to check if there is an attribute called filename on the original flowfile and its the same passed the output stream flowfile. If there is, then you should specify it as "filename" in the merge content property and NOT as "${filename}".
Created ‎06-14-2022 08:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @SAMSAL, thanks a lot for you help. I'm getting data as expected.
