Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

apache nifi - How to stop the single processor in nifi1.1.0 using rest api

I am trying to stop the processor which is in running state using the PUT method in rest api /processors/{id}.

I am able to start the processor by changing the state in the component as follows "state": "RUNNING", and runStatus in the aggregatesnapshot as "runStatus": "Running".

Similarly I tried to stop the processor by changing the state as STOPPED but facing an error as

9204b68d-0159-1000-7d8f-720592b2a2dd is not stopped (409 error conflict nd 400 Badrequest).

Please let me know how to stop the processor.

Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

you can able to stop processor using rest api.

Example:

i having GetFile(ID:9204b68d-0159-1000-7d8f-720592b2a2dd) processor in UI.

RestAPI Url:

http://<host>:<port>/nifi-api/processors/9204b68d-0159-1000-7d8f-720592b2a2dd

Here json content i have passed as PUT Request to stop processor.

{
  "status": {
    "runStatus": "STOPPED"
  },
  "component": {
    "state": "STOPPED",
    "id": "9204b68d-0159-1000-7d8f-720592b2a2dd"
  },
  "id": "9204b68d-0159-1000-7d8f-720592b2a2dd",
  "revision": {
    "version": 10,
    "clientId": "ab010dd6-0159-1000-615b-f095502a7ceb"
  }
} 

Revision and Status are most important things in stop the processor from RestAPI.

It works well for me.Try it.

And let me know if not worked.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...