<?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: Can i  stop  InvokeHttp  processor by another processor? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220037#M66763</link>
    <description>&lt;P&gt;I   have tried  restapi  with  put  request  i used  links like this  in my another invokehttp processsor &lt;A href="http://localhost:8080/nifi-api/processors/ea5db028-015d-1000-5ad5-80fd006dda92"&gt;http://localhost:8080/nifi-api/processors/ea5db028-015d-1000-5ad5-80fd006dda92&lt;/A&gt;    and  now  i want to  know  ow can i link  json components  like this  to  my put request  body?&lt;/P&gt;&lt;PRE&gt;{
  "status": {
    "runStatus": "STOPPED"
  },
  "component": {
    "state": "STOPPED",
    "id": "ea5db028-015d-1000-5ad5-80fd006dda92"
  },
  "id": "ea5db028-015d-1000-5ad5-80fd006dda92",
  "revision": {
    "version": 46,
    "clientId": "ef592126-015d-1000-bf4f-93c7cf7eedc0"
  }
} 



&lt;BR /&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 17 Aug 2017 18:47:02 GMT</pubDate>
    <dc:creator>salome_tkhilais</dc:creator>
    <dc:date>2017-08-17T18:47:02Z</dc:date>
    <item>
      <title>Can i  stop  InvokeHttp  processor by another processor?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220036#M66762</link>
      <description>&lt;P&gt;I  have service invokation in invokeHTTP processor  and  it  has  relaited  response  i want to  stop invokehttp as soon as response fails is it  possible to use another invokehttp processor  for rest api  to stop previous invokehttp  or i will need  to generate another flowfile for it?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 13:58:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220036#M66762</guid>
      <dc:creator>salome_tkhilais</dc:creator>
      <dc:date>2017-08-17T13:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can i  stop  InvokeHttp  processor by another processor?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220037#M66763</link>
      <description>&lt;P&gt;I   have tried  restapi  with  put  request  i used  links like this  in my another invokehttp processsor &lt;A href="http://localhost:8080/nifi-api/processors/ea5db028-015d-1000-5ad5-80fd006dda92"&gt;http://localhost:8080/nifi-api/processors/ea5db028-015d-1000-5ad5-80fd006dda92&lt;/A&gt;    and  now  i want to  know  ow can i link  json components  like this  to  my put request  body?&lt;/P&gt;&lt;PRE&gt;{
  "status": {
    "runStatus": "STOPPED"
  },
  "component": {
    "state": "STOPPED",
    "id": "ea5db028-015d-1000-5ad5-80fd006dda92"
  },
  "id": "ea5db028-015d-1000-5ad5-80fd006dda92",
  "revision": {
    "version": 46,
    "clientId": "ef592126-015d-1000-bf4f-93c7cf7eedc0"
  }
} 



&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Aug 2017 18:47:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220037#M66763</guid>
      <dc:creator>salome_tkhilais</dc:creator>
      <dc:date>2017-08-17T18:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can i  stop  InvokeHttp  processor by another processor?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220038#M66764</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/30155/salometkhilaishvili.html" nodeid="30155"&gt;@sally sally&lt;/A&gt;&lt;P&gt;You can use the response output to trigger another processor, you won't have to generate another flow file.  A better processor to use would be the ExecuteScript or ExecuteStreamCommand processor to make the rest api call.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 19:52:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220038#M66764</guid>
      <dc:creator>Wynner</dc:creator>
      <dc:date>2017-08-17T19:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can i  stop  InvokeHttp  processor by another processor?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220039#M66765</link>
      <description>&lt;P&gt;Can  you give me a link of example  how can  i do it, I have tried  this  but it doesn't  work for me:&lt;/P&gt;&lt;PRE&gt;For GenerateFlowFiele i  have:

[{
  "status": {
    "runStatus": "STOPPED"
  },
  "component": {
    "state": "STOPPED",
    "id": "ea5db028-015d-1000-5ad5-80fd006dda92"
  },
  
  "revision": {
    "version": 46,
    "clientId": "ef592126-015d-1000-bf4f-93c7cf7eedc0"
  }
} ]
and related groovy code in executeScript processor:

import org.apache.commons.io.IOUtils
import java.nio.charset.*
def flowFile = session.get();
if (flowFile == null) {
    return;
}


def slurper = new groovy.json.JsonSlurper()
def attrs = [:] as Map&amp;lt;String,String&amp;gt;
 
session.read(flowFile,
    { inputStream -&amp;gt;
        def text = IOUtils.toString(inputStream, StandardCharsets.UTF_8)
		text=flowFile.getAttribute('text')
        def obj = slurper.parseText(text)
		
        obj.each {k,v -&amp;gt;
           attrs[k] = v.toString()
        }
    } as InputStreamCallback)
flowFile = session.putAllAttributes(flowFile, attrs)
session.transfer(flowFile, REL_SUCCESS)
&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Aug 2017 00:52:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220039#M66765</guid>
      <dc:creator>salome_tkhilais</dc:creator>
      <dc:date>2017-08-18T00:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Can i  stop  InvokeHttp  processor by another processor?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220040#M66766</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/30155/salometkhilaishvili.html" nodeid="30155" target="_blank"&gt;@sally sally&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I don't have a specific link to a doc, but here is an example of what I did once using the ExecuteStreamCommand processor.&lt;/P&gt;&lt;P&gt;Here is a a snapshot of the configuration of the ExecuteStreamCommand processor. My particular example stops and starts the processor. Also, you can put the script anywhere the NiFi process is able to access and execute it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="30381-screen-shot-2017-08-17-at-41234-pm.png" style="width: 801px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15917iF81EB1AA321C7B0F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="30381-screen-shot-2017-08-17-at-41234-pm.png" alt="30381-screen-shot-2017-08-17-at-41234-pm.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is the script, this script had to retrieve a token, because my particular instance of NiFi was secured and used LDAP for authentication. If your instance of NiFi isn't secured then you could skip that first step and none of your curl commands will need the -H 'Authorization: Bearer'$token'' parameter.  In addition, you'll have to change the processor uuid to match the uuid of the InvokeHttp processor and the URL of the NiFi instance should match yours.&lt;/P&gt;&lt;PRE&gt;#!/bin/bash

# Get access token from LDAP server
token=$(curl 'https://nifi-server:9091/nifi-api/access/token' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'username=username&amp;amp;password=password' --compressed --insecure --tlsv1.2)
#echo token = $token

# Get the latest version of the flow
version=$(curl 'https://nifi-server:9091/nifi-api/processors/62c34df2-015b-1000-89e3-e2e77533331e' -X GET -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Authorization: Bearer '$token'' --compressed --insecure --tlsv1.2 | awk -F'[/:]' '{print $4}' | head -c2)
#echo version = $version

# This command is stopping the processor
curl 'https://nifi-server:9091/nifi-api/processors/62c34df2-015b-1000-89e3-e2e77533331e' -X PUT -H 'Host: nifi-ambari-02:9091' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Referer: https://nifi-ambari-02:9091/nifi/' -H 'Content-Type: application/json' -H 'Authorization: Bearer '$token'' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --data '{"revision":{"clientId":"6386076d-015b-1000-2a22-714f84689191","version":'$version'},"component":{"id":"62c34df2-015b-1000-89e3-e2e77533331e","state":"STOPPED"}}' --insecure --tlsv1.2
echo
sleep 15

# This step starts the processor
curl 'https://nifi-server:9091/nifi-api/processors/62c34df2-015b-1000-89e3-e2e77533331e' -X PUT -H 'Host: nifi-ambari-02:9091' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Referer: https://nifi-ambari-02:9091/nifi/' -H 'Content-Type: application/json' -H 'Authorization: Bearer '$token'' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --data '{"revision":{"clientId":"6386076d-015b-1000-2a22-714f84689191","version":'$version'},"component":{"id":"62c34df2-015b-1000-89e3-e2e77533331e","state":"RUNNING"}}' --insecure --tlsv1.2
# Echo a blank line
echo
&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Aug 2019 02:32:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220040#M66766</guid>
      <dc:creator>Wynner</dc:creator>
      <dc:date>2019-08-18T02:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can i  stop  InvokeHttp  processor by another processor?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220041#M66767</link>
      <description>&lt;P&gt;thnank  you &lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 12:18:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220041#M66767</guid>
      <dc:creator>salome_tkhilais</dc:creator>
      <dc:date>2017-08-18T12:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can i  stop  InvokeHttp  processor by another processor?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220042#M66768</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/30155/salometkhilaishvili.html" nodeid="30155"&gt;@sally sally&lt;/A&gt;&lt;P&gt;If the answer helped, please accept it.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 19:04:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-i-stop-InvokeHttp-processor-by-another-processor/m-p/220042#M66768</guid>
      <dc:creator>Wynner</dc:creator>
      <dc:date>2017-08-18T19:04:50Z</dc:date>
    </item>
  </channel>
</rss>

