0

I am trying to do something that I feel should be relatively simple, but I am struggling immensely to conceptualize how to execute this process.

At a high level I am simply unpacking a zip file into a directory. Once that is complete, I need to execute a python script.

The issue I am having is that I can't determine the best method to achieve this goal. I assume Notify/Wait will be the answer, but setting the release signal identifier and only releasing when all flowfiles have been placed, does not appear to be possible? I have also tried MergeContent using a like attribute, but I only want a single merged flowfile, and I cannot set the minimum # of entries = to ${fragment.count}. Please see below for any screenshots that may be beneficial. Thank you.

enter image description here

2
  • 1
    What does the python script do? Does it execute once for each FlowFile or once for all 16? Commented Oct 25, 2021 at 21:51
  • It will execute a series of batch scripts which handle logic related to the files. But we only want to execute the batch scripts if all the files are in the directory. So in shorter terms - once for all 16. Commented Oct 26, 2021 at 12:19

1 Answer 1

2

If you are using UnpackContent, all unpacked flowfiles get fragment identifier, index and count attributes - see the Writes Attributes section of the docs.

If you want to collect all of these into a single FlowFile, you can use MergeContent with a Merge Strategy of Defragment. This will take all of the FlowFiles created by the UnpackContent and merge them into a single FlowFile - it will group by the identifier and wait until it has seen every index up to the count - thus if 16 FlowFiles were produced, it will merge all 16 into 1.

You can use that single FlowFile to trigger your script.

Sign up to request clarification or add additional context in comments.

2 Comments

Will check this out and report back. I assumed MergeContent could handle this, but I did not realize UnpackContent had those identifiers. Thank you.
Marked as the answer. Thank you for this information. I didn't fully understand the mergecontent processor, but definitely have a better understanding now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.