Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to use mergecontent in nifi with splitJson to send email

avatar
New Contributor

Hi 

 

I have problem when I want to use mergecontent  I mean I want to wait for all the process to complete then do something 

I have split Json that afflict on my result 

How can I merge everything then use execte sql to call query from m table and put it in csv then send one email

the problem is the merge content  not work i reserved many emails 

i try wait and notify but not work.

 

I hope my question in clear 

1 REPLY 1

avatar
Super Mentor

@SAli12 

 

Please share how you have your MergeContent processor configured.

If I am following your query correctly, you have a source FlowFile that you pass through a SplitJson processor which produce a number of output FlowFiles.

Later after processing all those individual FlowFile you want to combine them all back in to a single FlowFile so that you can generate only a single FlowFile which gets passed to a putEmail processor.

Correct?

If that is the case, the SplitJson will create a set of Attributes on each split FlowFile it creates:

MattWho_0-1630523646060.png


Within either the MergeContent or MergeRecord processor you have the option to set the "Merge Strategy" to "Defragment".

MattWho_1-1630523762321.png


This strategy uses those attributes on the FlowFile to bin files base on the fragment.identifier and makes sure that all files are present before a merge happens***.  
Note: if all bins are being utilized by different fragment identifiers and another unique identifier comes in, the oldest bin will be processed and sent to failure since it is missing all it fragments.

But above should get you the one FlowFile your are looking for instead of multiple FlowFiles with partial merges of merges of your original source file.

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