<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to detect all branches in a NiFi flow have finished processing? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383490#M244923</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/109186"&gt;@iriszhuhao&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This might be a good use case for using the &lt;A href="https://nifi.apache.org/documentation/nifi-2.0.0-M1/html/user-guide.html#Flowfile_Concurrency" target="_blank"&gt;FlowFile Concurrency&lt;/A&gt;&amp;nbsp; and &lt;A href="https://nifi.apache.org/documentation/nifi-2.0.0-M1/html/user-guide.html#Outbound_Policy" target="_blank"&gt;Outbound Policy&lt;/A&gt; configuration option on a process group.&amp;nbsp; FlowFile concurrency allows you to place a portion of your dataflow into a process group and be able to control how the initial FlowFile or batch of FlowFiles is allowed to enter that process group for processing.&amp;nbsp; The Outbound Policy controls when the FlowFiles being processed in that process group will be released to processor(s) downstream of that process group.&amp;nbsp; Downstream components of the process group will not receive FlowFiles from the process group until all FlowFiles within the process group have either been auto-terminated or queued up to one or more output ports.&amp;nbsp; When the outbound policy is met, the FlowFile(s) are released downstream and the Process group's FlowFile concurrency then allows for next batch processing.&amp;nbsp; So it might makes sense to place the portion of your dataflow comprised of your nine concurrent branches in this bounded process group and downstream you have your your ExecuteSQLRecord processor call your final procedure now that you know all branches have completed.&lt;BR /&gt;&lt;BR /&gt;Above solves your problem with not all nine branches always being used.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you found &lt;STRONG&gt;any of the suggestions/solutions&lt;/STRONG&gt; provided helped you with your issue, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on &lt;STRONG&gt;one or more&lt;/STRONG&gt; of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Feb 2024 14:04:17 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2024-02-14T14:04:17Z</dc:date>
    <item>
      <title>How to detect all branches in a NiFi flow have finished processing?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383475#M244918</link>
      <description>&lt;P&gt;Hi! I'm using NiFi 2.0.0 M1, and I'm writing a flow inside a processed group. I had a problem when I wrote the flow.&lt;/P&gt;&lt;P&gt;The flow should be run as an individual task. Every time when it is run, it will take in some data from a table on MySQL Server, use many &lt;STRONG&gt;LookupRecord&lt;/STRONG&gt; Processors and then process the matched and unmatched data respectively. Finally, it turns out to have &lt;STRONG&gt;9 branches&lt;/STRONG&gt; within the flow.&lt;/P&gt;&lt;P&gt;After processing all these, I need to trigger an &lt;STRONG&gt;ExecuteSQLRecord&lt;/STRONG&gt; processor which will call some stored procedures in MySQL. &lt;STRONG&gt;Literally, only when all the above branches finish running should this processor be triggered (and it should be triggered only once in one task).&lt;/STRONG&gt; To achieve this, I wanted to use &lt;STRONG&gt;Notify&lt;/STRONG&gt; and &lt;STRONG&gt;Wait&lt;/STRONG&gt; processor to detect whether all the branches finish running and when I should trigger the &lt;STRONG&gt;ExecuteSQLRecord&lt;/STRONG&gt; processor. However, I can only set &lt;STRONG&gt;a fixed number of signals&lt;/STRONG&gt; to wait for in the Wait processor, while in the real case, sometimes &lt;STRONG&gt;not all of the 9 branches will be run&lt;/STRONG&gt;. (Because, sometimes, there won't be matched or unmatched data for a lookup processor, and hence the corresponding branch won't be triggered to run.)&lt;/P&gt;&lt;P&gt;Did anyone face the same problem as mine? Is there any good way to achieve my goal?&lt;/P&gt;&lt;P&gt;(Below is part of the flow. You can see that I tried to use Wait but was kind of stuck there &lt;span class="lia-unicode-emoji" title=":loudly_crying_face:"&gt;😭&lt;/span&gt;)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="iriszhuhao_0-1707902687817.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39699i7EDC0C23E34F662A/image-size/large?v=v2&amp;amp;px=999" role="button" title="iriszhuhao_0-1707902687817.png" alt="iriszhuhao_0-1707902687817.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 09:27:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383475#M244918</guid>
      <dc:creator>iriszhuhao</dc:creator>
      <dc:date>2024-02-14T09:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to detect all branches in a NiFi flow have finished processing?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383480#M244920</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/109186"&gt;@iriszhuhao&lt;/a&gt;,&amp;nbsp;Welcome to our community! To help you get the best possible answer, I have tagged our NiFi experts&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/103151"&gt;@cotopaul&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp; who may be able to assist you further.&lt;BR /&gt;&lt;BR /&gt;Please feel free to provide any additional information or details about your query, and we hope that you will find a satisfactory solution to your question.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 10:50:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383480#M244920</guid>
      <dc:creator>VidyaSargur</dc:creator>
      <dc:date>2024-02-14T10:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to detect all branches in a NiFi flow have finished processing?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383485#M244921</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/109186"&gt;@iriszhuhao&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;The wait processor is supposed to be used with the Notify processor to work correctly and its more suited for when&amp;nbsp; you have a data that will be split downstream&amp;nbsp; where each split flowfile will have a common identifier and split count that the Wait-Notify processors can go by&amp;nbsp; as explained in this article:&lt;/P&gt;&lt;P&gt;&lt;A href="https://pierrevillard.com/2018/06/27/nifi-workflow-monitoring-wait-notify-pattern-with-split-and-merge/" target="_blank"&gt;https://pierrevillard.com/2018/06/27/nifi-workflow-monitoring-wait-notify-pattern-with-split-and-merge/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;When you get the data from SQL do you get it all in one flowfile or its already split where each record in one flowfile. If you are not getting a lot of data then I would recommend to get it all in one flowfile and then split it so that you can use this pattern and to run the final SP once. So the design will look something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_3-1707916946248.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39703i56BECEA370030DDA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_3-1707916946248.png" alt="SAMSAL_3-1707916946248.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case the Wait-Notify Signal identifier will be the value of the fragment.identifier and the Wait Target Signal Count will be the value of the fragment.count which both written by the Split processor.&lt;/P&gt;&lt;P&gt;If you find this helpful please &lt;STRONG&gt;accept&lt;/STRONG&gt; solution.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 13:24:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383485#M244921</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2024-02-14T13:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to detect all branches in a NiFi flow have finished processing?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383486#M244922</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/109186"&gt;@iriszhuhao&lt;/a&gt;, to be really honest, your problem is not 100% related to NiFi, as this is more of an architectural question.&lt;/P&gt;&lt;P&gt;How would you achieve what you are trying to achieve in another ETL Graphical Tool (Informatica, Talend, Knime, etc)? That logic should be applied in your case as well, as most of the tools perform the same thing but in a different manner.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Now, going back to your question, bear in mind that this might not be the best solution, but you could implemented a signaling table where you store the execution of each of your 9 flows. Basically you create a database table in which you will store something like PROCESSOR_ID, PROCeSSOR_NAME, EXECUTION_TIME, SUCCES. From each of your success flows, you will go into a processor where you generate this data and afterwards insert the content into your table. Next, out of your final processor (the one saving the data in your database) you could into an RetryFlowFile where you set a penalty of X seconds/hours/minutes. From that flow file, you then go into an ExecuteSQLRecord and interogate your table. The output of the ExecuteSQLRecord is then sent into a query processor and check if all 9 flows have entered a row in your table. If all 9 inserted a row in your table, you proceed to do what you want. If not all 9 flows inserted a row in your table, you go into an processor where you call the NiFi's Rest API to check the status of your affected processors (you can do that with an ExecuteStreamCommand, ExecuteScript, InvokeHTTP, etc). You can call the &lt;EM&gt;/nifi-api/flow/processors/YOUR_MISSING_PROCESSOR/status&lt;/EM&gt; API and check the results (statsLastRefreshed, flowFilesIn, flowFilesOut) to see whether something came or should have came through that flow. Next, based on your logic, you can proceed next to checking other processors or call the stored procedure to end your flow. Lastly, you can truncate your table once your execution is done, if you do not want to keep some historical data there.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Again, this might not be the best solution, but this is the first thing I would try if I were in your situation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 13:32:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383486#M244922</guid>
      <dc:creator>cotopaul</dc:creator>
      <dc:date>2024-02-14T13:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to detect all branches in a NiFi flow have finished processing?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383490#M244923</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/109186"&gt;@iriszhuhao&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This might be a good use case for using the &lt;A href="https://nifi.apache.org/documentation/nifi-2.0.0-M1/html/user-guide.html#Flowfile_Concurrency" target="_blank"&gt;FlowFile Concurrency&lt;/A&gt;&amp;nbsp; and &lt;A href="https://nifi.apache.org/documentation/nifi-2.0.0-M1/html/user-guide.html#Outbound_Policy" target="_blank"&gt;Outbound Policy&lt;/A&gt; configuration option on a process group.&amp;nbsp; FlowFile concurrency allows you to place a portion of your dataflow into a process group and be able to control how the initial FlowFile or batch of FlowFiles is allowed to enter that process group for processing.&amp;nbsp; The Outbound Policy controls when the FlowFiles being processed in that process group will be released to processor(s) downstream of that process group.&amp;nbsp; Downstream components of the process group will not receive FlowFiles from the process group until all FlowFiles within the process group have either been auto-terminated or queued up to one or more output ports.&amp;nbsp; When the outbound policy is met, the FlowFile(s) are released downstream and the Process group's FlowFile concurrency then allows for next batch processing.&amp;nbsp; So it might makes sense to place the portion of your dataflow comprised of your nine concurrent branches in this bounded process group and downstream you have your your ExecuteSQLRecord processor call your final procedure now that you know all branches have completed.&lt;BR /&gt;&lt;BR /&gt;Above solves your problem with not all nine branches always being used.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you found &lt;STRONG&gt;any of the suggestions/solutions&lt;/STRONG&gt; provided helped you with your issue, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on &lt;STRONG&gt;one or more&lt;/STRONG&gt; of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 14:04:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383490#M244923</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2024-02-14T14:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to detect all branches in a NiFi flow have finished processing?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383583#M244966</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thank you for the reply. I believe the FlowFile Concurrency and Outbound Policy can solve the detection problem. However, further, is there a way to run the downstream processors only &lt;STRONG&gt;once&lt;/STRONG&gt; per batch of FlowFiles, as multiple FlowFiles will be released from the output port as a batch after I set Outbound Policy to Batch Output&lt;SPAN&gt;? (The downstream processor does not need to process any FlowFile but only calls some stored procedures in the database, so it should only run once per input to the overall flow.)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 02:46:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383583#M244966</guid>
      <dc:creator>iriszhuhao</dc:creator>
      <dc:date>2024-02-19T02:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to detect all branches in a NiFi flow have finished processing?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383638#M244994</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/109186"&gt;@iriszhuhao&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I would use ModifyBytes processor within the Process group just before the output port to remove the content of the FlowFiles.&amp;nbsp; The outside the Process Group add a MergeContent that will merge all those 0 bytes FlowFiles just released in a batch from the Process Group before you execute your stored procedures.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you found&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;any of the suggestions/solutions&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;provided helped you with your issue, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on&amp;nbsp;&lt;STRONG&gt;one or more&lt;/STRONG&gt;&amp;nbsp;of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 16:07:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383638#M244994</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2024-02-20T16:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to detect all branches in a NiFi flow have finished processing?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383737#M245035</link>
      <description>&lt;P&gt;I had a need for multiple Lookups...custom Groovy processor with several LookUp services as a part of it...consolidated that, routed accordingly, and performed faster.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 21:45:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-detect-all-branches-in-a-NiFi-flow-have-finished/m-p/383737#M245035</guid>
      <dc:creator>joseomjr</dc:creator>
      <dc:date>2024-02-21T21:45:33Z</dc:date>
    </item>
  </channel>
</rss>

