Created 08-25-2021 03:39 AM
Hi,
Would like to seek an example of caching the 2 singe flow file attribute (filename attribute) and store it for later part processing.
Scenario:
1) Folder containing (file1.xml and file2.txt)
2) Using NiFi GetFile processor to get both file
3) Get the attribute of both files (filename)
4) store it for future storage into database
Looking forward for the help with example and explanation. Appreciate the helps. Thanks
Created 09-01-2021 12:55 PM
After you fetch the two files, you could route the success relationship twice via two different connections. One of those connection continues those two files down you r existing dataflow path. The secondary path could go to a replaceText processor that replaces the entire content of the FlowFile with the filename which is store in a FlowFile attribute named "filename". Editing the content down this secondary path does not affect the content of the FlowFile in the other dataflow path.
Now that you have the filename in the content you can use other processors to store that content with the filename wherever you want for future retrieval. or you could merge those flowfile in to single FlowFile that would then contain the list of filenames before you store it. This is just a matter of your specific use case for later consumption of this stored data.
Take a look at the putDistributedMapCache processor as an example.
If you found this response addressed your query, please take a moment to login and click on "Accept as Solution" below this post.
Thank you,
Matt