<?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: Process Group level counter in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402682#M251749</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;It's ok for me if the Counter values are lost when NiFi is restarted. I can deal with that. Can I read their values in&lt;SPAN&gt;&amp;nbsp;ExecuteScript / ExecuteGroovyScript?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I used this to increment it, but I wasn't able to read the value itself.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;session.adjustCounter("my_counter", 1, true)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'll look into Distributed Map Cache. I'm unfamiliar with it. Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Feb 2025 21:13:18 GMT</pubDate>
    <dc:creator>Emery</dc:creator>
    <dc:date>2025-02-20T21:13:18Z</dc:date>
    <item>
      <title>Process Group level counter</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402648#M251739</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I'm looking for a way to implement a process group level counter that I can read and update either with a processor, including ExecuteScript / ExecuteGroovyScript.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;I've looked at and tried:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;. Counters: I can create one, set the value and increment it, but not read the value within a processor, that I've found as of yet.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;. Parameter Context parameters: I can read the value, but not increment or reset it. It seems to be static once it's defined.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;Is there something I've missed with the above, or does anyone have another suggestion please?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 20 Feb 2025 16:27:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402648#M251739</guid>
      <dc:creator>Emery</dc:creator>
      <dc:date>2025-02-20T16:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: Process Group level counter</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402681#M251748</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/119498"&gt;@Emery&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;1. Counters: NiFi counters only exist in NiFi heap, so values are lost if NiFi is restarted.&amp;nbsp;&lt;BR /&gt;2. Parameter Contexts are static defined values intended use across many components thus along a single place to update when needed.&lt;BR /&gt;&lt;BR /&gt;I don't know what your use case is for these counters, but perhaps you could use the following processors to maintain a count and be able to fetch the value when needed in your dataflows:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A class="component-link" href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.28.0/org.apache.nifi.processors.standard.PutDistributedMapCache/index.html" target="component-usage"&gt;PutDistributedMapCache&amp;nbsp;&lt;SPAN class="version"&gt;1.28.0&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A class="component-link" href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.28.0/org.apache.nifi.processors.standard.FetchDistributedMapCache/index.html" target="component-usage"&gt;FetchDistributedMapCache&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="version"&gt;1.28.0&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN class="version"&gt;So you can Fetch current value from cache, update it, and put replace value in cache.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Please help our community grow and thrive. If you found&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;any&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of the suggestions/solutions provided helped you with solving your issue or answering your question, 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;SPAN class="version"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 20:53:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402681#M251748</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2025-02-20T20:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Process Group level counter</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402682#M251749</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;It's ok for me if the Counter values are lost when NiFi is restarted. I can deal with that. Can I read their values in&lt;SPAN&gt;&amp;nbsp;ExecuteScript / ExecuteGroovyScript?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I used this to increment it, but I wasn't able to read the value itself.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;session.adjustCounter("my_counter", 1, true)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'll look into Distributed Map Cache. I'm unfamiliar with it. Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 21:13:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402682#M251749</guid>
      <dc:creator>Emery</dc:creator>
      <dc:date>2025-02-20T21:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Process Group level counter</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402715#M251754</link>
      <description>&lt;P&gt;I've read up a bit on&lt;SPAN&gt;DistributedMapCacheServer and s&lt;/SPAN&gt;etting up and accessing ports, and its purpose&lt;SPAN&gt;&amp;nbsp;really feels larger than what I'm looking for.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'd just like the ability to maintain a simple counter within a process group that I can read, increment and reset, best within a groovy script.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Parameters and Counters, or something else if it exists, would totally suit the purpose. Is there a way&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;I can read counter values in&amp;nbsp;ExecuteScript / ExecuteGroovyScript that I'm missing?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 13:54:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402715#M251754</guid>
      <dc:creator>Emery</dc:creator>
      <dc:date>2025-02-21T13:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Process Group level counter</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402716#M251755</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/119498"&gt;@Emery&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You are correct that there is only an option for adjusting a counter either up or down.&amp;nbsp; There is no process session for retrieving the value from a counter.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/processor/ProcessSession.java#L123" target="_blank"&gt;https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/processor/ProcessSession.java#L123&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You could make a NiFi rest-api call to get the complete list of counters.&amp;nbsp; You would need to then filter out the specific counter(s) you want to get the value you are looking for from the json response.&lt;/P&gt;&lt;P&gt;Please help our community grow and thrive. If you found&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;any&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of the suggestions/solutions provided helped you with solving your issue or answering your question, 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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 14:01:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402716#M251755</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2025-02-21T14:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Process Group level counter</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402718#M251757</link>
      <description>&lt;P&gt;I read about that possibility. Also with that, making a rest api call for a simple "global variable" within a process group or across a single process flow uses more processing resources and time than I would think is optimal, but I may be wrong.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 14:37:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402718#M251757</guid>
      <dc:creator>Emery</dc:creator>
      <dc:date>2025-02-21T14:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Process Group level counter</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402721#M251759</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/119498"&gt;@Emery&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;No argument with you there.&amp;nbsp; A rest-api call fetches a json of all counters which you then need to parse to extract the specific counter value you are looking for.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The NiFi counters where never intended to be used for anything more then simple counts during flow development testing.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Matt&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 16:57:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402721#M251759</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2025-02-21T16:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Process Group level counter</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402723#M251760</link>
      <description>&lt;P&gt;That's unfortunate. All I require is a simple counter. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 18:34:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/402723#M251760</guid>
      <dc:creator>Emery</dc:creator>
      <dc:date>2025-02-21T18:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Process Group level counter</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/403628#M252136</link>
      <description>&lt;P&gt;With the help of the information&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;provided in&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/t5/Support-Questions/Using-MapCacheServer-and-MapCacheClientService-in-NiFi/td-p/403402" target="_blank"&gt;https://community.cloudera.com/t5/Support-Questions/Using-MapCacheServer-and-MapCacheClientService-in-NiFi/td-p/403402&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I've been able to implement a counter as I required. Not with&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PutDistributedMapCache / FetchDistributedMapCache, but more flexibly with ExecuteScript.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks for your help. I really appreciate it.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 05 Mar 2025 13:29:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Process-Group-level-counter/m-p/403628#M252136</guid>
      <dc:creator>Emery</dc:creator>
      <dc:date>2025-03-05T13:29:25Z</dc:date>
    </item>
  </channel>
</rss>

