[英]Apache Nifi : Execute / Trigger Nifi Processor From Java Application
Is it possible to call the Apache Nifi ListenHTTP processor or HandleHttpRequest from the java application ?是否可以从 java 应用程序调用 Apache Nifi ListenHTTP 处理器或 HandleHttpRequest ? Also How to send my custom arguments to ListenHTTP "Remote URL" property from a java application?
另外如何将我的自定义 arguments 从 java 应用程序发送到 ListenHTTP“远程 URL”属性?
How to set properties of a Processor through Java API?如何通过 Java API 设置处理器的属性?
How to pass a parameter through an URL to a Nifi processor group ?如何通过 URL 将参数传递给Nifi 处理器组? And how can I start the processor group through that URL.
以及如何通过该 URL 启动处理器组。
http://localhost:8080/api/firstname/{first_name}/lastname/{last_name}
I want to send first_name and last_name from my java application to Nifi processor ?我想将我的 java 应用程序中的 first_name 和 last_name 发送到 Nifi 处理器? how to achieve this?
如何做到这一点?
There are a few different questions here.这里有几个不同的问题。
ListenHTTP
or HandleHttpRequest
processors from a separate Java application?ListenHTTP
或HandleHttpRequest
处理器交互? - use any HTTP client from your Java application to send a request. URLConnection
class orHttpClient
, or using a library like Apache HTTP Components .URLConnection
class 或HttpClient
一样简单,或者使用像Apache HTTP Components这样的库。GET
request, or forming the request body for a POST
request).GET
请求,或形成请求主体以获取POST
请求)。InvokeHTTP
processor, not the ListenHTTP
processor based on the available properties.InvokeHTTP
处理器,而不是基于可用属性的ListenHTTP
处理器。 If you want to send data from a regular Java application to NiFi via HTTP, you would configure your ListenHTTP
processor to listen on a specific port and base path , and then make HTTP connections to that address.ListenHTTP
处理器配置为侦听特定端口和基本路径,然后将 Z293C9EA246FF9985DC6F62A650F7 连接到该地址So for example, using the default base path and port 8888, an external application would make a request to http://localhost:8888/contentListener
with request body {"firstname": "Andy", "lastname": "LoPresto"}
in order to provide that JSON.http://localhost:8888/contentListener
发出请求,请求正文为{"firstname": "Andy", "lastname": "LoPresto"}
为了提供 JSON。 The flowfile content would then contain those values.ListenHTTP
processor doesn't provide arbitrary URL parsing to extract those values from the querystring, so you would have to manually perform that logic. ListenHTTP
处理器不提供任意 URL 解析来从查询字符串中提取这些值,因此您必须手动执行该逻辑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.