在Nifi中托管API [英] Hosting an API in Nifi
问题描述
我想使用HandleHTTP处理器在Nifi中托管API.我想获得一些有关如何做的信息/资源. 我是Nifi的新手. 预先感谢.
I want to host an API in Nifi using HandleHTTP processor. I would like to get some information/resources about how to do it. I am new to Nifi. Thanks in Advance.
推荐答案
@Prathik
我为您创建了一个基本模板,其中包括HandleHttpRequest(入站端口80调用),用于使用JSON进行处理的进程组和HandleHttpResponse(提供200响应代码)以响应入站呼叫.这是NiFi最简单的形式的API.根据您的用例,您可以建立Process Api Request流程组以满足您的需求.开箱即用,您应该能够导入模板,添加/启动StandHttpContextMap Controller服务,启动流程,然后使用Postman将呼叫发送到http://yournifihost:80并将JSON放在流程的底部.Success队列.
I have created a basic template for you which includes the HandleHttpRequest (inbound port 80 call) a process group for doing something with the JSON, and HandleHttpResponse (provides 200 response code) to respond to inbound call. This is an API in the simplest form with NiFi. Depending on your use case you can build out Process Api Request Process Group to suit your needs. Out of the box you should be able to import template, add/start the StandHttpContextMap Controller Service, Start the flow, then use Postman to send a call to http://yournifihost:80 and have JSON sitting in the bottom of the flow Success Queue.
您可以在此处找到模板: https://github.com/steven-matison/NiFi-模板/blob/master/NiFi_API_with_HandleHttpRequest_Demo.xml
You can find the template here: https://github.com/steven-matison/NiFi-Templates/blob/master/NiFi_API_with_HandleHttpRequest_Demo.xml
我在Cloudera社区上对相同问题的任何官方答复:
Any my official response to the same question on Cloudera Community here:
https://community.cloudera.com/t5/Support-Questions/Hosting-an-API-in-Nifi/td-p/301966
这篇关于在Nifi中托管API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!