在NiFi处理器"InvokeHTTP"中,您在哪里编写POST请求的正文? [英] In NiFi processor 'InvokeHTTP' where do you write body of POST request?

查看:772
本文介绍了在NiFi处理器"InvokeHTTP"中,您在哪里编写POST请求的正文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在发布有关Apache NiFi InvokeHTTP的问题之前,我已经遍历了所有其他问题及其答案,但是我仍然不确定应该拥有的最佳流程.我的情况如下:

Before posting this question about Apache NiFi InvokeHTTP I have gone through all other questions and their answersbut I am still unsure the best flow I should have. My situation is as below:

1)从Apache Kakfa,我获得了原始元数据.

1) From Apache Kakfa, I get raw metadata.

2)使用EvaluateJSONPath得到我想要的属性.

2) Using EvaluateJSONPath I get attribute I want.

3)使用RouteOnAttribute,我根据从上面的第2步获得的属性值创建了3条路由.

3) Using RouteOnAttribute I created 3 routes based on the attribute value I got from step-2 above.

4)现在,基于属性值,我想决定是否应该进行GET或POST还是Delete.

4) Now based on the attribute value I want to decide whether I should go for GET or for POST or for Delete.

5)我的问题是在哪里/如何设置POST消息? GET消息?删除邮件正文?

5) My question is where/how to set POST message? GET message? Delete Message body?

6)我可以在InvokeHTTP提供的配置部分中设置URL.但是消息正文我不知道那个属性是什么?或其使用ReplaceText的流文件中?

6) I am able to set the URL in configuration part provided by InvokeHTTP. But message body I don't know which is that property? or its in flow file using ReplaceText?

我在某处读到,在将Restful POST HTTP请求转移到InvokeHTTP之前,您必须具有另一个处理器才能更改流文件的内容.

I read somewhere that before you divert your Restful POST HTTP request to InvokeHTTP you must have another processor before which changes the content of flow file.

参考:配置来自Nifi的HTTP POST请求

请帮助.谢谢. 问候, 是的

Please help. Thanks. regards, Yeshwant

推荐答案

在Bryan解释的内容之外,POST将把FlowFile内容用作消息正文,因此,如果您要擦除/转换成其他一些数据,然后作为消息正文发送,您可以利用以下处理器:

Adding on to what Bryan had explained, POST will use the FlowFile content as the message body so if you have some other data which you want to wipe/transform into something and then sent as the message body, you can leverage the following processors :

  • ExtractText从现有FlowFile内容中读取数据
  • ReplaceText删除FlowFile的现有内容,并将其替换为其他内容
  • ExtractText to read data from the existing FlowFile content
  • ReplaceText to erase the existing content of the FlowFile and replace it with different one

要设置REST调用的头,InvokeHTTP具有属性Attributes to Send,该属性带有一个正则表达式,该正则表达式将针对传入的FlowFiles的属性进行扫描,并且将匹配的任何属性作为HTTP头发送.

To set the headers for the REST calls, InvokeHTTP has the property Attributes to Send property which takes a regex which will scanned against the incoming FlowFiles' attributes and whichever attributes are matched are taken and sent as HTTP header.

要将新属性添加到现有FlowFile中,可以使用UpdateAttribute

To add new attribute to your existing FlowFile, you can use UpdateAttribute

这篇关于在NiFi处理器"InvokeHTTP"中,您在哪里编写POST请求的正文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆