- 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 can I WAIT on two processors in NIFI? Final processor needs to check for both before continuing...
- Labels:
-
Apache NiFi
Created 03-15-2017 07:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I'm working on creating a flow like this:
1st processor does work and goes into a funnel
2nd processor does work and routes to same funnel
Final processor needs to check for both before continuing. How do I accomplish this?
NOTE: I do not need the actual file flows, they are only used as trigger files.
Thanks!
Created on 03-21-2017 11:48 AM - edited 08-18-2019 05:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another possible solution until the Wait and Notify processors are available.
You can use MergeContent configured to only merge when it hits 2 files (which may work for you because you don't need the final flow files and you just want a trigger in this case):
This first flow trigger will be held in queue before the MergeContent, and will only be merged once the second flow trigger has arrived. The merged flowfile that comes out of the MergeContent will be your final trigger.
Note, I used the following configurations to get this to work:
- Back pressure on both 'success' flows going into MergeContent (set to only allow 1 file in queue at a time before the merge)
- MergeContent configured with:
- Minimum Number of Entries = 2
- Maximum Number of Entries = 2
- Correlation Attribute Name = 'my-attribute' (I added this attribute to each UpdateAttribute processor - this would only be required if you wanted to have multiple triggers going into the MergeContent and you wanted to control the final trigger based on a correlation attribute)
I've attached the xml flow template for your reference.
Created 03-15-2017 08:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you could might be able to use the new Wait and Notify processors that should be in the upcoming 1.2 release of Apache NiFi.
1st processor -> Notify -> Funnel
2nd processor -> Notify -> Funnel
Funnel -> Wait (Signal Count == 2)
Not sure if that is exactly what you described, but seems like it could work.
https://ijokarumawak.github.io/nifi/2017/02/02/nifi-notify-batch/
Created 03-20-2017 05:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bump for any other possible solutions?
Created on 03-21-2017 11:48 AM - edited 08-18-2019 05:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another possible solution until the Wait and Notify processors are available.
You can use MergeContent configured to only merge when it hits 2 files (which may work for you because you don't need the final flow files and you just want a trigger in this case):
This first flow trigger will be held in queue before the MergeContent, and will only be merged once the second flow trigger has arrived. The merged flowfile that comes out of the MergeContent will be your final trigger.
Note, I used the following configurations to get this to work:
- Back pressure on both 'success' flows going into MergeContent (set to only allow 1 file in queue at a time before the merge)
- MergeContent configured with:
- Minimum Number of Entries = 2
- Maximum Number of Entries = 2
- Correlation Attribute Name = 'my-attribute' (I added this attribute to each UpdateAttribute processor - this would only be required if you wanted to have multiple triggers going into the MergeContent and you wanted to control the final trigger based on a correlation attribute)
I've attached the xml flow template for your reference.
Created 03-21-2017 08:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, this is exactly the type of workaround I was looking for!