<?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: Reset the Filename sequence no./counter  everyday in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377516#M243286</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Maybe you could reset the state via NiFi-REST-API at beginning of your flow or separately&amp;nbsp;on a schedule cron every morning&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Could be:&lt;BR /&gt;POST "https://[ip:port]/nifi-api/processors/${processor-id}/state/clear-requests"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the request which NiFi itself uses when you go to the processor in the UI and choose the menu-option "view state" -&amp;gt; "clear state".&lt;/P&gt;</description>
    <pubDate>Wed, 11 Oct 2023 17:53:04 GMT</pubDate>
    <dc:creator>drewski7</dc:creator>
    <dc:date>2023-10-11T17:53:04Z</dc:date>
    <item>
      <title>Reset the Filename sequence no./counter  everyday</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377498#M243281</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Every 5 min i have a file generated from the NiFi Processor GenerateFlowFile:&lt;/P&gt;&lt;P&gt;filename_0.xml&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename_1.xml&lt;/P&gt;&lt;P&gt;filename_2.xml&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;I would like to asked how do i reset the sequence no. everyday ?&lt;/P&gt;&lt;P&gt;Thanks. Would appreciate help with example and explanation.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The first method i found is using nextInt():&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="techNerd_0-1697203874269.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38634i7C47ACEF8F44F0B3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="techNerd_0-1697203874269.png" alt="techNerd_0-1697203874269.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="techNerd_1-1697203906116.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38635i11275E4671E2EEB1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="techNerd_1-1697203906116.png" alt="techNerd_1-1697203906116.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;the second method is using seq:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="techNerd_2-1697204344772.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38636iEE8C126ACEFF579B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="techNerd_2-1697204344772.png" alt="techNerd_2-1697204344772.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="techNerd_3-1697204364634.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38637i333B32108DAC181F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="techNerd_3-1697204364634.png" alt="techNerd_3-1697204364634.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please advise me with steps and example. thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 13:40:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377498#M243281</guid>
      <dc:creator>techNerd</dc:creator>
      <dc:date>2023-10-11T13:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Reset the Filename sequence no./counter  everyday</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377516#M243286</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Maybe you could reset the state via NiFi-REST-API at beginning of your flow or separately&amp;nbsp;on a schedule cron every morning&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Could be:&lt;BR /&gt;POST "https://[ip:port]/nifi-api/processors/${processor-id}/state/clear-requests"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the request which NiFi itself uses when you go to the processor in the UI and choose the menu-option "view state" -&amp;gt; "clear state".&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 17:53:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377516#M243286</guid>
      <dc:creator>drewski7</dc:creator>
      <dc:date>2023-10-11T17:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reset the Filename sequence no./counter  everyday</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377529#M243289</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/79092"&gt;@drewski7&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thanks for the replying.&amp;nbsp;&lt;/P&gt;&lt;P&gt;From your reply, I have added in NiFi InvokeHTTP processor which will automatically help to reset my seq no. counter every morning.&amp;nbsp; I am using the second method above which using seq no. which store state locally.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="techNerd_0-1697126686575.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38639i1E09F4C4B331569E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="techNerd_0-1697126686575.png" alt="techNerd_0-1697126686575.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="techNerd_1-1697126955480.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38640i8210CAB165C576E9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="techNerd_1-1697126955480.png" alt="techNerd_1-1697126955480.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have set the HTTP Method to POST and HTTP URL to&amp;nbsp;&lt;A href="https://[ip:port]/nifi-api/processors/${processor-id}/state/clear-requests" target="_blank"&gt;https://[ip:port]/nifi-api/processors/${processor-id}/state/clear-requests&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="techNerd_3-1697127005144.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38642i1CF841FAF5B50BD0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="techNerd_3-1697127005144.png" alt="techNerd_3-1697127005144.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have scheduled the NiFi InvokeHTTP Processor to run every morning 00:00 using CRON driven Scheduling Strategy&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="techNerd_5-1697127267535.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38644iB80F0990EFD67AFD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="techNerd_5-1697127267535.png" alt="techNerd_5-1697127267535.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below image are the NiFi UpdateAttribute Processor which show the processor ID that i used inside my HTTP URL&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="techNerd_4-1697127103612.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38643i070746DE66DBEECB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="techNerd_4-1697127103612.png" alt="techNerd_4-1697127103612.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Just to check did i did it correctly as what you mention in your reply ?&lt;/P&gt;&lt;P&gt;I tried to change my computer time to 11:55 pm and let it run to 00:00 the next day, but it does not invokeHTTP POST request once it reach 00:00. I might have made some mistake somewhere.&lt;/P&gt;&lt;P&gt;appreciate if you could advise me with example and explanation. Thanks a lot.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 23:42:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377529#M243289</guid>
      <dc:creator>techNerd</dc:creator>
      <dc:date>2023-10-11T23:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Reset the Filename sequence no./counter  everyday</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377579#M243299</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/79092"&gt;@drewski7&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I noticed that the invokeHTTP processor will only POST request to clear state when the updateAttribute processor&amp;nbsp; which contain the state is STOP.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Error Message:&lt;/P&gt;&lt;P&gt;i got from invokeHTTP processor "UpdateAttribute[id=e6c537bd-c24b-1801-6fdd-b37c23c97fcd] cannot be updated because it is not stopped"&lt;/P&gt;&lt;P&gt;1) If it is true, how can i make the invokeHTTP processor to clear the state when the updateAttribute processor is running&lt;/P&gt;&lt;P&gt;2) If it is not true, what are the step or setting i should set to make sure the invokeHTTP processor clear the state of the updateAttribute processor while both processor is running ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 15:55:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377579#M243299</guid>
      <dc:creator>techNerd</dc:creator>
      <dc:date>2023-10-12T15:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Reset the Filename sequence no./counter  everyday</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377654#M243312</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;Any help that i can get from you? thanks. I would like to clear state everyday without stopping the processor. Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2023 14:24:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377654#M243312</guid>
      <dc:creator>techNerd</dc:creator>
      <dc:date>2023-10-14T14:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Reset the Filename sequence no./counter  everyday</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377715#M243327</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/85077"&gt;@techNerd&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Clearing a processor components state requires stopping the processor before you can "clear the state".&amp;nbsp; Stopped state is required because the the processor may be writing or updating state when you attempt to clear state which would cause issues. When stopped there is no need to worry about a race condition between writes and deletes.&lt;BR /&gt;&lt;BR /&gt;That being said, reseting the sequence number stored in state to 0 can be accomplished using the advanced UI of the UpdateAttribute processor and a special reset-seq flowfile you feed into the processor at 00:00 each day.&amp;nbsp; The advance UI of the UpdateAttribute processor works like if,the,else logic.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So you would set up a Rule "reset" and a condition (if), If condition is true the "Actions" are applied.&amp;nbsp; If no Rules's&amp;nbsp; conditions are true, the processor's non advanced UI properties are applied.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;UpdateAttribute properties (same as you already have):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_3-1697491218564.png" style="width: 702px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38664iBB1ACC27659C965C/image-dimensions/702x374?v=v2" width="702" height="374" role="button" title="MattWho_3-1697491218564.png" alt="MattWho_3-1697491218564.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Click on "advanced" in lower left corner of processor configuration UI to open and configure Rules:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_0-1697490808422.png" style="width: 717px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38661i2017D0C178AEA572/image-dimensions/717x365?v=v2" width="717" height="365" role="button" title="MattWho_0-1697490808422.png" alt="MattWho_0-1697490808422.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now all you need to do is setup a GenerateFlowFile processor that feeds a FlowFile into the updateAttribute processor once a day to reset seq to 0 stored in tat UpdateAttributes processor's local state.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_1-1697491013007.png" style="width: 708px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38662iD43907922702ED03/image-dimensions/708x384?v=v2" width="708" height="384" role="button" title="MattWho_1-1697491013007.png" alt="MattWho_1-1697491013007.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Optionally&amp;nbsp; you could add a RouteOnAttribute processor after the UpdateAttribute to route out the sequence file for termination so it does not continue through your dataflow.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_2-1697491062451.png" style="width: 716px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38663i49059E96C1904F2E/image-dimensions/716x283?v=v2" width="716" height="283" role="button" title="MattWho_2-1697491062451.png" alt="MattWho_2-1697491062451.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;If you found any of the suggestions/solutions 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 one or more 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>Mon, 16 Oct 2023 21:22:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Reset-the-Filename-sequence-no-counter-everyday/m-p/377715#M243327</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2023-10-16T21:22:13Z</dc:date>
    </item>
  </channel>
</rss>

