在 NiFi 处理器“InvokeHTTP"中,你在哪里写 POST 请求的主体? [英] In NiFi processor 'InvokeHTTP' where do you write body of POST request?

查看:52
本文介绍了在 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 消息?获取消息?删除邮件正文?

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天全站免登陆