根据 NiFi 中的内容更新属性 [英] Update attributes based on content in NiFi
问题描述
如何在开发 Apache NiFi 定制处理器时向当前流文件添加属性.
我想要做的是使用计算值向当前流文件添加新属性(或至少更新当前属性).
或者是否有我可以使用的已经构建的处理器?
NiFi 支持多种创建和更新属性的方法,具体取决于您希望使用的数据源.一些通用处理器包括:
您可以使用一个处理器添加尽可能多的属性.我建议浏览 Apache NiFi 表达语言指南 感受一下你可以用它做什么.
ExtractText - 通过将正则表达式应用于流文件内容来设置属性值.
ExecuteScript - ExecuteScript 运行自定义脚本代码,可用于根据需要更新属性.
还有更多针对特定内容格式的内容,例如:
- EvaluateJsonPath - 用于 JSON
- EvaluateXPath - 用于 XML
How can I add a attribute to the current flow file when developing an Apache NiFi cusom processor.
What I want to do is adding a new attribute (or at least update a current attribute) to the current flow file with calculated value.
Or is there an already built processor that I can use?
NiFi supports several methods of creating and updating attributes, depending on the data source you wish to use. Some general purpose processors include:
UpdateAttribute - Updates attributes on flow files using both static values and NiFi's expression language.
You can add as many properties with one processor. I recommend scanning through the Apache NiFi Expression Language Guide to get a feel for what you can do with it.
ExtractText - The Sets attribute values by applying regular expressions to the flowfile content.
ExecuteScript - ExecuteScript Runs custom script code, which can be used to update attributes however you wish.
And there are more for particular content formats, for example:
- EvaluateJsonPath - for JSON
- EvaluateXPath - for XML
这篇关于根据 NiFi 中的内容更新属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!