<?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: NiFi AttributeRollingWindow 1.5.0 - start_curr_batch_ts as attribute? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-AttributeRollingWindow-1-5-0-start-curr-batch-ts-as/m-p/222607#M77370</link>
    <description>&lt;P&gt;Thanks &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt;, that's a very comprehensive explanation. I'll see what I can make from this.&lt;/P&gt;&lt;P&gt;Chris.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Apr 2018 15:29:59 GMT</pubDate>
    <dc:creator>hello2</dc:creator>
    <dc:date>2018-04-18T15:29:59Z</dc:date>
    <item>
      <title>NiFi AttributeRollingWindow 1.5.0 - start_curr_batch_ts as attribute?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-AttributeRollingWindow-1-5-0-start-curr-batch-ts-as/m-p/222605#M77368</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I'm experimenting with the AttributeRollingWindow processor for a solution to monitor the number of messages hitting different Kafka topics. Is there any way of getting the start_curr_batch_ts values (available in the View State menu) in to a flow file's attributes along with the usual rolling_window_count, ..._mean and _value?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chris.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 17:26:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-AttributeRollingWindow-1-5-0-start-curr-batch-ts-as/m-p/222605#M77368</guid>
      <dc:creator>hello2</dc:creator>
      <dc:date>2018-04-17T17:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi AttributeRollingWindow 1.5.0 - start_curr_batch_ts as attribute?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-AttributeRollingWindow-1-5-0-start-curr-batch-ts-as/m-p/222606#M77369</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/28678"&gt;@Chris&lt;/a&gt; Grren&lt;/P&gt;&lt;P&gt;We cannot add &lt;STRONG&gt;Stored State values&lt;/STRONG&gt; to the flow files attributes, How ever you can create custom processor which can implement the logic of getting current batch timestamp attribute added to each flowfile.&lt;BR /&gt;You can also use &lt;STRONG&gt;RestApi &lt;/STRONG&gt;call to the &lt;STRONG&gt;AttributeRollingWindow &lt;/STRONG&gt;processor to know what is the current batch &lt;STRONG&gt;timestamp &lt;/STRONG&gt;value.&lt;/P&gt;&lt;P&gt;We can use &lt;STRONG&gt;Get&lt;/STRONG&gt; method with make a call to the below path to get the current state of the processor&lt;/P&gt;&lt;PRE&gt;GET /processors/{id}/state //Gets the state for a processor &lt;/PRE&gt;&lt;P&gt;For more details about Rest Api calls refer to &lt;A href="https://nifi.apache.org/docs/nifi-docs/rest-api/index.html" target="_blank" rel="nofollow noopener noreferrer"&gt;this&lt;/A&gt; link.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Example:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;As i'm having AttributeRollingWindow processor with processor id as  d372cfe5-0162-1000-398e-62f2d3652166 and from command line we need to make rest api call as below.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Making Rest Api call from Command Line:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;$ curl -i -X GET -H 'Content-Type:application/json' &lt;A href="http://localhost:8080/nifi-api/processors/d372cfe5-0162-1000-398e-62f2d3652166/state" target="_blank" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/nifi-api/processors/d372cfe5-0162-1000-398e-62f2d3652166/state&lt;/A&gt;&lt;/PRE&gt;
&lt;STRONG&gt;Response:-&lt;BR /&gt;&lt;/STRONG&gt;as you can view below these are the states saved in the processor and the first key is our current batch timestamp i.e 1524017336077&lt;PRE&gt;{
  "componentState" : {
    "componentId" : "d372cfe5-0162-1000-398e-62f2d3652166",
    "stateDescription" : "Store the values backing the rolling window. This includes storing the individual values and their time-stamps or the batches of values and their counts.",
    "localState" : {
      "scope" : "LOCAL",
      "totalEntryCount" : 7,
      "state" : [ {
        "key" : "1524017336077", //current batch timestamp
        "value" : "1.0"
      }, {
        "key" : "1524017336079",
        "value" : "1.0"
      }, {
        "key" : "1524017336082",
        "value" : "1.0"
      }, {
        "key" : "1524017336083",
        "value" : "1.0"
      }, {
        "key" : "1524017336085",
        "value" : "1.0"
      }, {
        "key" : "1524017336086",
        "value" : "1.0"
      }, {
        "key" : "count",
        "value" : "7"
      } ]
    }
  }
}

&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;States stored in the processor:-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="68512-states.png" style="width: 1228px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15680iAAC7A96ACB1F8D2C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="68512-states.png" alt="68512-states.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Making same Rest Api call from NiFi processor:-&lt;/U&gt;&lt;/STRONG&gt;&lt;BR /&gt;use &lt;STRONG&gt;InvokeHttp processor&lt;/STRONG&gt; with Remote URL as &lt;/P&gt;&lt;PRE&gt;&lt;A href="http://localhost:8080/nifi-api/processors/d372cfe5-0162-1000-398e-62f2d3652166/state" target="_blank" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/nifi-api/processors/d372cfe5-0162-1000-398e-62f2d3652166/state&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="68514-invokehttp.png" style="width: 2678px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15681i24155407EDFD19FE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="68514-invokehttp.png" alt="68514-invokehttp.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Output:-&lt;/U&gt;&lt;/STRONG&gt;&lt;BR /&gt;From the response relationship you will get same response as above&lt;/P&gt;&lt;PRE&gt;{
  "componentState" : {
    "componentId" : "d372cfe5-0162-1000-398e-62f2d3652166",
    "stateDescription" : "Store the values backing the rolling window. This includes storing the individual values and their time-stamps or the batches of values and their counts.",
    "localState" : {
      "scope" : "LOCAL",
      "totalEntryCount" : 7,
      "state" : [ {
        "key" : "1524017336077", //current batch timestamp
        "value" : "1.0"
      }, {
        "key" : "1524017336079",
        "value" : "1.0"
      }, {
        "key" : "1524017336082",
        "value" : "1.0"
      }, {
        "key" : "1524017336083",
        "value" : "1.0"
      }, {
        "key" : "1524017336085",
        "value" : "1.0"
      }, {
        "key" : "1524017336086",
        "value" : "1.0"
      }, {
        "key" : "count",
        "value" : "7"
      } ]
    }
  }
}&lt;/PRE&gt;&lt;P&gt;As the first state array value will be your current batch timestamp.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;If the Answer Addressed your question, &lt;STRONG&gt;Click on Accept button below to accept the answer,&lt;/STRONG&gt; That would be great help to Community users to find solution quickly for these kind of issues.&lt;/P&gt;
&lt;BR /&gt;&lt;IMG src="https://community.cloudera.com/t5/image/serverpage/image-id/7979iB98D7DBD0E49E0C1/image-size/large?v=1.0&amp;amp;px=999" border="0" alt="flow.png" title="flow.png" /&gt;</description>
      <pubDate>Sun, 18 Aug 2019 02:04:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-AttributeRollingWindow-1-5-0-start-curr-batch-ts-as/m-p/222606#M77369</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T02:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi AttributeRollingWindow 1.5.0 - start_curr_batch_ts as attribute?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-AttributeRollingWindow-1-5-0-start-curr-batch-ts-as/m-p/222607#M77370</link>
      <description>&lt;P&gt;Thanks &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt;, that's a very comprehensive explanation. I'll see what I can make from this.&lt;/P&gt;&lt;P&gt;Chris.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 15:29:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-AttributeRollingWindow-1-5-0-start-curr-batch-ts-as/m-p/222607#M77370</guid>
      <dc:creator>hello2</dc:creator>
      <dc:date>2018-04-18T15:29:59Z</dc:date>
    </item>
  </channel>
</rss>

