Reputation: 307
Is it possible to call the Apache Nifi ListenHTTP processor or HandleHttpRequest from the java application? Also How to send my custom arguments to ListenHTTP "Remote URL" property from a java application?
How to set properties of a Processor through Java API?
How to pass a parameter through an URL to a Nifi processor group? And how can I start the processor group through that 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? how to achieve this?
Upvotes: 1
Views: 2523
Reputation: 14194
There are a few different questions here.
ListenHTTP
or HandleHttpRequest
processors from a separate Java application? - use any HTTP client from your Java application to send a request. This can be as simple as using the URLConnection
class or HttpClient
, or using a library like Apache HTTP Components. GET
request, or forming the request body for a POST
request). InvokeHTTP
processor, not the ListenHTTP
processor based on the available properties. 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. 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. The flowfile content would then contain those values. The ListenHTTP
processor doesn't provide arbitrary URL parsing to extract those values from the querystring, so you would have to manually perform that logic. Upvotes: 1