rest - Nifi:Stopping processor without restApi and wait/notify processor -
i want stop proceesor when fails have generated flowfile related json content:
{ "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" } }
and have 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 = [:] map<string,string> session.read(flowfile, { inputstream -> def text = ioutils.tostring(inputstream, standardcharsets.utf_8) text=flowfile.getattribute('text') attrs = slurper.parsetext(text) def obj = slurper.parsetext(text) obj.each {k,v -> attrs[k] = v.tostring() } } inputstreamcallback) flowfile = session.putattribute(flowfile,'filename',attrs['id']) flowfile = session.write(flowfile, {outputstream -> def builder = new groovy.json.jsonbuilder(attrs) outputstream.write(builder.toprettystring().getbytes(standardcharsets.utf_8)) } outputstreamcallback) session.transfer(flowfile, rel_success)
is there way can invoke service(without rest api , wait/notify processors ) executescript , stop failed invokehttp processor nifi processor?
which processor should use operaion used invokehtp url : http://localhost:8080/nifi-api/processors/${filename} doen't work me.
Comments
Post a Comment