<?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 initialize a processor via NIFI API in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-initialize-a-processor-via-NIFI-API/m-p/239641#M201450</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/112611/mtigua.html" target="_blank"&gt;@Mario Tigua&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can use the REST api to clear state on the processor. You can get the curl command to do this using the Developer tools available in the Chrome browser. Then pass that command, in a script, to a ExecuteStreamCommand processor that is triggered after the files are fetched and clear the state of the ListSFTP processor. For example:&lt;/P&gt;&lt;P&gt;This simple flow shows how you could list the files, fetch them and then after they're fetched, use the results flow files to trigger the state being cleared in the ListSFTP processor:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="108426-screen-shot-2019-05-06-at-92743-am.png" style="width: 891px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/13920i44F293A8CF3355BA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="108426-screen-shot-2019-05-06-at-92743-am.png" alt="108426-screen-shot-2019-05-06-at-92743-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The configuration of the ExecuteStreamCommand processor looks like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="108427-screen-shot-2019-05-06-at-93005-am.png" style="width: 894px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/13921iEBAD64DCD7F971AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="108427-screen-shot-2019-05-06-at-93005-am.png" alt="108427-screen-shot-2019-05-06-at-93005-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The contents of the curl-script.sh file, of course you would fill in the appropriate host and port for your environment as well as the uuid of the processor.&lt;/P&gt;&lt;PRE&gt;#!/bin/bash

# curl command to stop processor
curl 'http://nifi-host:nifi-port/nifi-api/processors/84415a50-016a-1000-0000-00001257b02c' -X PUT -H 'Origin: &lt;A href="http://nifi-host:nifi-port'" target="_blank" rel="nofollow noopener noreferrer"&gt;http://nifi-host:nifi-port'&lt;/A&gt;; -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36' -H 'Content-Type: application/json' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: &lt;A href="http://nifi-host:nifi-port/nifi/'" target="_blank" rel="nofollow noopener noreferrer"&gt;http://nifi-host:nifi-port/nifi/'&lt;/A&gt;; -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --data-binary '{"revision":{"clientId":"8440f58c-016a-1000-f56a-4b8ca84fb669","version":30},"component":{"id":"84415a50-016a-1000-0000-00001257b02c","state":"STOPPED"}}' --compressed

# curl command to clear state
curl 'http://nifi-host:nifi-port/nifi-api/processors/84415a50-016a-1000-0000-00001257b02c/state/clear-requests' -X POST -H 'Origin: &lt;A href="http://nifi-host:nifi-port'" target="_blank" rel="nofollow noopener noreferrer"&gt;http://nifi-host:nifi-port'&lt;/A&gt;; -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: &lt;A href="http://nifi-host:nifi-port/nifi/'" target="_blank" rel="nofollow noopener noreferrer"&gt;http://nifi-host:nifi-port/nifi/'&lt;/A&gt;; -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'Content-Length: 0' --compressed&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The curl command can be obtained by&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="108436-screen-shot-2019-05-06-at-93143-am.png" style="width: 905px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/13922i3AF7797D6475039E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="108436-screen-shot-2019-05-06-at-93143-am.png" alt="108436-screen-shot-2019-05-06-at-93143-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then using the Developer tool, get the curl command when you manually clear the state of the processor&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="108517-screen-shot-2019-05-06-at-93457-am.png" style="width: 606px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/13923i93F14EFD8A9BBE3C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="108517-screen-shot-2019-05-06-at-93457-am.png" alt="108517-screen-shot-2019-05-06-at-93457-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This example was done with an insecure instance of NiFi, if NiFi is secure, you'll have to get a token to run the curl commands.&lt;/P&gt;</description>
    <pubDate>Sat, 17 Aug 2019 22:38:03 GMT</pubDate>
    <dc:creator>Wynner</dc:creator>
    <dc:date>2019-08-17T22:38:03Z</dc:date>
    <item>
      <title>How to initialize a processor via NIFI API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-initialize-a-processor-via-NIFI-API/m-p/239639#M201448</link>
      <description>&lt;P&gt;Hi everyone, please help!&lt;/P&gt;&lt;P&gt;I'm using ListSFTP processor to get files and process them. In the first execution the processor take the files normally, but when you start the processor the second time it doesn't. I know this is the correct behavior for this processor. Is there any way to start and initialize the processor via NIFI API in such a way that It takes the files again? I need this approach because I need to do testing. &lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 02:12:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-initialize-a-processor-via-NIFI-API/m-p/239639#M201448</guid>
      <dc:creator>mtigua</dc:creator>
      <dc:date>2019-05-03T02:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to initialize a processor via NIFI API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-initialize-a-processor-via-NIFI-API/m-p/239640#M201449</link>
      <description>&lt;P&gt;I didn't see such a property when I looked at &lt;A rel="noopener noreferrer noopener noreferrer" href="http://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.9.2/org.apache.nifi.processors.standard.ListFTP/index.html," target="_blank"&gt;http://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.9.2/org.apache.nifi.processors.standard.ListFTP/index.html,&lt;/A&gt; but some quick solutions to jumpstart this could be to simply replace this processor with a new one (which will have its own state management) or if you using "timestamps" for the "Listing Strategy" property then you could always do a linux "touch" command on the files on the FTP server which should trick the processors to grab them again.&lt;/P&gt;&lt;P&gt;Good luck and happy Flowfiling!&lt;/P&gt;</description>
      <pubDate>Sun, 05 May 2019 01:52:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-initialize-a-processor-via-NIFI-API/m-p/239640#M201449</guid>
      <dc:creator>LesterMartin</dc:creator>
      <dc:date>2019-05-05T01:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to initialize a processor via NIFI API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-initialize-a-processor-via-NIFI-API/m-p/239641#M201450</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/112611/mtigua.html" target="_blank"&gt;@Mario Tigua&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can use the REST api to clear state on the processor. You can get the curl command to do this using the Developer tools available in the Chrome browser. Then pass that command, in a script, to a ExecuteStreamCommand processor that is triggered after the files are fetched and clear the state of the ListSFTP processor. For example:&lt;/P&gt;&lt;P&gt;This simple flow shows how you could list the files, fetch them and then after they're fetched, use the results flow files to trigger the state being cleared in the ListSFTP processor:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="108426-screen-shot-2019-05-06-at-92743-am.png" style="width: 891px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/13920i44F293A8CF3355BA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="108426-screen-shot-2019-05-06-at-92743-am.png" alt="108426-screen-shot-2019-05-06-at-92743-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The configuration of the ExecuteStreamCommand processor looks like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="108427-screen-shot-2019-05-06-at-93005-am.png" style="width: 894px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/13921iEBAD64DCD7F971AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="108427-screen-shot-2019-05-06-at-93005-am.png" alt="108427-screen-shot-2019-05-06-at-93005-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The contents of the curl-script.sh file, of course you would fill in the appropriate host and port for your environment as well as the uuid of the processor.&lt;/P&gt;&lt;PRE&gt;#!/bin/bash

# curl command to stop processor
curl 'http://nifi-host:nifi-port/nifi-api/processors/84415a50-016a-1000-0000-00001257b02c' -X PUT -H 'Origin: &lt;A href="http://nifi-host:nifi-port'" target="_blank" rel="nofollow noopener noreferrer"&gt;http://nifi-host:nifi-port'&lt;/A&gt;; -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36' -H 'Content-Type: application/json' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: &lt;A href="http://nifi-host:nifi-port/nifi/'" target="_blank" rel="nofollow noopener noreferrer"&gt;http://nifi-host:nifi-port/nifi/'&lt;/A&gt;; -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --data-binary '{"revision":{"clientId":"8440f58c-016a-1000-f56a-4b8ca84fb669","version":30},"component":{"id":"84415a50-016a-1000-0000-00001257b02c","state":"STOPPED"}}' --compressed

# curl command to clear state
curl 'http://nifi-host:nifi-port/nifi-api/processors/84415a50-016a-1000-0000-00001257b02c/state/clear-requests' -X POST -H 'Origin: &lt;A href="http://nifi-host:nifi-port'" target="_blank" rel="nofollow noopener noreferrer"&gt;http://nifi-host:nifi-port'&lt;/A&gt;; -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: &lt;A href="http://nifi-host:nifi-port/nifi/'" target="_blank" rel="nofollow noopener noreferrer"&gt;http://nifi-host:nifi-port/nifi/'&lt;/A&gt;; -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'Content-Length: 0' --compressed&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The curl command can be obtained by&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="108436-screen-shot-2019-05-06-at-93143-am.png" style="width: 905px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/13922i3AF7797D6475039E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="108436-screen-shot-2019-05-06-at-93143-am.png" alt="108436-screen-shot-2019-05-06-at-93143-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then using the Developer tool, get the curl command when you manually clear the state of the processor&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="108517-screen-shot-2019-05-06-at-93457-am.png" style="width: 606px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/13923i93F14EFD8A9BBE3C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="108517-screen-shot-2019-05-06-at-93457-am.png" alt="108517-screen-shot-2019-05-06-at-93457-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This example was done with an insecure instance of NiFi, if NiFi is secure, you'll have to get a token to run the curl commands.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Aug 2019 22:38:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-initialize-a-processor-via-NIFI-API/m-p/239641#M201450</guid>
      <dc:creator>Wynner</dc:creator>
      <dc:date>2019-08-17T22:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to initialize a processor via NIFI API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-initialize-a-processor-via-NIFI-API/m-p/239642#M201451</link>
      <description>&lt;P&gt;Thanks @Wynner, it works!&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 01:37:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-initialize-a-processor-via-NIFI-API/m-p/239642#M201451</guid>
      <dc:creator>mtigua</dc:creator>
      <dc:date>2019-05-07T01:37:55Z</dc:date>
    </item>
  </channel>
</rss>

