@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:
Within either the MergeContent or MergeRecord processor you have the option to set the "Merge Strategy" to "Defragment".
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