<?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: Attribute based flow lock - Similar to Wait Notify, but not quite. in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Attribute-based-flow-lock-Similar-to-Wait-Notify-but-not/m-p/317570#M227232</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/88633"&gt;@_mark_&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;As NiFi is an open source product, I recommend joining the community (if you have not already) and opening an Apache NiFi Jira [1] with you proposed enhancements/new features for Apache NiFi to get feedback from the community at large.&lt;BR /&gt;&lt;BR /&gt;If you feel you are not there yet in proposing a new feature/enhancement, try engaging via the users mailing list [2]&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;[1]&amp;nbsp;&lt;A href="https://issues.apache.org/jira/browse/NIFI" target="_blank"&gt;https://issues.apache.org/jira/browse/NIFI&lt;/A&gt;&lt;BR /&gt;[2]&amp;nbsp;&lt;A href="https://nifi.apache.org/mailing_lists.html" target="_blank"&gt;https://nifi.apache.org/mailing_lists.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Matt&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jun 2021 16:30:59 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2021-06-02T16:30:59Z</dc:date>
    <item>
      <title>Attribute based flow lock - Similar to Wait Notify, but not quite.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Attribute-based-flow-lock-Similar-to-Wait-Notify-but-not/m-p/316940#M226949</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to implement a lock mechanism in a data flow that prevents a flow file from progressing.&amp;nbsp; Similar in a way to&amp;nbsp; the wait processor, holding a flowfile in a queue while another flowfile with a corresponding signal attribute passes through a 'gate' further down the flow, similar to a notify.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my specific case I load a number of files received together in to target tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a single flow which does the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;PutSql - issues a truncate table command that empties the target staging table.&amp;nbsp; The table name is taken from an attribute.&lt;/LI&gt;&lt;LI&gt;PutDatabaseRecord - Inserts the records into the staging table based on the same attribute.&lt;/LI&gt;&lt;LI&gt;PutSql - executes a stored procedure passing the relevant tables name as parameter from the attribute.&amp;nbsp; This SP merges data from the staging table into a 'main' table.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;A number of these files, share the same staging and target tables and on occasions I have a race condition where the the staging table is truncated by a second flowfile before the stored procedure has had time to run for the first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are never more than two flowfiles destined for the same target table currently, so I'm able to mitigate the issue by routing one set to a retry processor and penalising the flowfiles for an arbitrary amount of time to give the first set time to complete their load.&amp;nbsp; This isn't particularly elegant and it doesn't feel like it would scale very well.&amp;nbsp; Also, my situation is likely to change, and I could have more than two common files in the future.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To my mind, if I could have a wait processor check a cache when a flowfile passes through it, and if the cache is empty it adds the target table name value to the cache as a signal.&amp;nbsp; After the third step above is complete for this flowfile, it passes through a notify type processor which removes the signal attribute from the cache releasing any flowfiles with a matching attribute from the queue on the earlier wait.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think I can get the wait and notify to work in this manner, but I could be wrong?&amp;nbsp; If so, is there another way to achieve this type of functionality&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm aware of the Processor Group FlowFile Concurrency and Outbound Policy settings, but these would be too restrictive only processing a single flow file at a time.&amp;nbsp; I would like to only process as many flowfiles concurrently as the DB will take, only holdiing the flowfiles which might cause the race condition.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope that's clear.&amp;nbsp; Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 20:25:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Attribute-based-flow-lock-Similar-to-Wait-Notify-but-not/m-p/316940#M226949</guid>
      <dc:creator>_mark_</dc:creator>
      <dc:date>2021-05-21T20:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute based flow lock - Similar to Wait Notify, but not quite.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Attribute-based-flow-lock-Similar-to-Wait-Notify-but-not/m-p/317349#M227137</link>
      <description>&lt;P&gt;I hope a bump to the top of the recent post list isn't breaking any rules, but I'm hoping someone might be able to offer an opinion, so a bump it is!&lt;/P&gt;</description>
      <pubDate>Sun, 30 May 2021 16:56:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Attribute-based-flow-lock-Similar-to-Wait-Notify-but-not/m-p/317349#M227137</guid>
      <dc:creator>_mark_</dc:creator>
      <dc:date>2021-05-30T16:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute based flow lock - Similar to Wait Notify, but not quite.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Attribute-based-flow-lock-Similar-to-Wait-Notify-but-not/m-p/317570#M227232</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/88633"&gt;@_mark_&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;As NiFi is an open source product, I recommend joining the community (if you have not already) and opening an Apache NiFi Jira [1] with you proposed enhancements/new features for Apache NiFi to get feedback from the community at large.&lt;BR /&gt;&lt;BR /&gt;If you feel you are not there yet in proposing a new feature/enhancement, try engaging via the users mailing list [2]&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;[1]&amp;nbsp;&lt;A href="https://issues.apache.org/jira/browse/NIFI" target="_blank"&gt;https://issues.apache.org/jira/browse/NIFI&lt;/A&gt;&lt;BR /&gt;[2]&amp;nbsp;&lt;A href="https://nifi.apache.org/mailing_lists.html" target="_blank"&gt;https://nifi.apache.org/mailing_lists.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Matt&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 16:30:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Attribute-based-flow-lock-Similar-to-Wait-Notify-but-not/m-p/317570#M227232</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2021-06-02T16:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute based flow lock - Similar to Wait Notify, but not quite.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Attribute-based-flow-lock-Similar-to-Wait-Notify-but-not/m-p/317641#M227264</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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll happily create a feature request, though I wasn't sure if I was missing something obvious that would meet my objective/requirements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for clarifying, I'll go take a look at the links you provided (admittedly I had missed the mailing lists, oops).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 13:32:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Attribute-based-flow-lock-Similar-to-Wait-Notify-but-not/m-p/317641#M227264</guid>
      <dc:creator>_mark_</dc:creator>
      <dc:date>2021-06-03T13:32:25Z</dc:date>
    </item>
  </channel>
</rss>

