1

Using Apache Nifi, I created a flow that read a Json file and splits it line by line in order to verify if the content is correct. After that I have 2 outputs: 1 - for successful line and 2-for unsuccessful ones and the output is a Json file.

For the moment, all the lines are stored into separate files but what I want to do is to store each "good" line into 1 file and each "bad" one in another.

What processor should I use?

4

1 回答 1

4

RouteText 处理器专为您正在尝试做的事情而设计。它允许您根据您创建的表达式将文本行路由到不同的关系。它为每个关系将每个 FlowFile 中的行捆绑在一起。

你可以在这里看到它的文档:https ://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.RouteText/index.html

您可以在此处使用 RouteText 获取示例模板(几乎完全按照您的意愿进行操作):https ://github.com/hortonworks-gallery/nifi-templates/blob/master/templates/SplitRouteMergeVsRouteText.xml

于 2016-03-16T16:42:09.320 回答