Created 02-02-2017 02:52 PM
Could Nifi provide a rest api to allow java program to submit the data?
I know Nifi can call a rest api from java, but can Nifi provide a api to allow other app to push data?
Thanks
Andy
Created 02-02-2017 02:54 PM
Hi @Andy Liang,
If you want to send data into NiFi through HTTP REST calls, you can use ListenHTTP processor. The data send to the endpoint you define in this processor will be the content of the generated flow files.
If you to manage what responses are sent to your client, you can also use the combination of HandleHttpRequest and HandleHttpResponse. The content of the flow file coming in HandleHttpResponse will be the body of the HTTP response sent to the client. This way you can, for example, create web services for external clients that need access to some data.
Hope this helps.
Created 02-02-2017 02:54 PM
Hi @Andy Liang,
If you want to send data into NiFi through HTTP REST calls, you can use ListenHTTP processor. The data send to the endpoint you define in this processor will be the content of the generated flow files.
If you to manage what responses are sent to your client, you can also use the combination of HandleHttpRequest and HandleHttpResponse. The content of the flow file coming in HandleHttpResponse will be the body of the HTTP response sent to the client. This way you can, for example, create web services for external clients that need access to some data.
Hope this helps.
Created 02-02-2017 03:10 PM
@Pierre Villard could the java app call the ListenHTTP processor or HandleHttpRequest directly in the java app? I know NiFi has rest-api, but I never use them. Do you know any tutorial/example/info is available?
Thanks a lot, Andy
Created 02-02-2017 03:40 PM
You can have a look at unit tests of this processor:
Created 02-07-2017 09:39 PM
@Pierre Villard Thanks a lot for your detail advice. HandleHttpRequest and HandleHttpResponse are exactly what I need.
Created 02-09-2021 10:41 AM
Here is a cool NiFi websocket app
https://www.datainmotion.dev/2020/12/ingesting-websocket-data-for-live-stock.html
Hosting web apps in NiFi
https://www.datainmotion.dev/2020/11/flank-smart-weather-websocket.html
https://www.datainmotion.dev/2020/12/ingesting-websocket-data-for-live-stock.html