我在测试环境中运行NiFi,并希望它作为最后一步部署自动启动所有处理器.
我是否需要解析所有处理器ID并为每个处理器ID点击/ nifi-api/processor端点,或者是否可以启动所有处理器ID - 例如从/ nifi-api/process-groups端点?
我的NiFi流程为uuid 66f83c1d-0162-1000-baff-01e60296540a - 此GET curl语句成功返回信息:
curl -i -X GET http://localhost:9090/nifi-api/process-groups/66f83c1d-0162-1000-baff-01e60296540a
Run Code Online (Sandbox Code Playgroud)
但是尝试PUT状态失败:
curl -i -X PUT -H 'Content-Type: application/json' -d '{"status":"RUNNING"}' http://localhost:9090/nifi-api/process-groups/66f83c1d-0162-1000-baff-01e60296540a
HTTP/1.1 400 Bad Request
Date: Mon, 06 Aug 2018 11:08:15 GMT
X-Frame-Options: SAMEORIGIN
Content-Type: text/plain
Vary: Accept-Encoding
Content-Length: 429
Server: Jetty(9.4.3.v20170317)
Cannot construct instance of `org.apache.nifi.web.api.dto.status.ProcessGroupStatusDTO` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('RUNNING')
at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 11] (through reference chain: org.apache.nifi.web.api.entity.ProcessGroupEntity["status"])
Run Code Online (Sandbox Code Playgroud)
是的,通过使用NiFi RestApi,我们可以启动处理器组中的所有处理器.
因为你在json 中缺少id键值,
{ "id":"66f83c1d-0162-1000-baff-01e60296540a","州":"运行"}
我们需要提到状态而不是状态来运行/停止组中的处理器
{"id":"66f83c1d-0162-1000-baff-01e60296540a","州":"运行" }
我们需要在其余api的地址中包含flow.
http:// localhost:9090/nifi-api / flow / process-groups/66f83c1d-0162-1000-baff-01e60296540a
尝试使用下面的Curl命令
curl -i -X PUT -H 'Content-Type: application/json' -d '{"id":"66f83c1d-0162-1000-baff-01e60296540a","state":"RUNNING"}' http://localhost:9090/nifi-api/flow/process-groups/66f83c1d-0162-1000-baff-01e60296540a
Run Code Online (Sandbox Code Playgroud)
请参阅此了解有关使用RESTAPI启动过程组的更多细节.
归档时间: |
|
查看次数: |
902 次 |
最近记录: |