Skip to main content
sangee
Silver ⭐️
May 13, 2021
Solved

if the flow file contains "HdF5 file is missing Merging completed" I have to route to some processor using Route Text processor and if the flow files contains only "Merging completed" I have route to some other processor....how can I configure Rout

Screenshot (39).png

MattWho
MattWhoAnswer
Titanium ⭐️⭐️⭐️
May 13, 2021

@sangee 

The "RouteText" [1] processor is used to route individual lines within a multi-line content FlowFile to different relationships (essentially splitting up a multi-line FlowFile).  What you are trying to accomplish can however be done using the "RouteOnContent" [2] processor.

Your sample shows content with two lines and only one of those lines containing the string "Merging completed".  So I assume the other FlowFIle's content will have only one line with "Merging complete"?

If so, the "RouteOnContent" can be configured as follows:

MattWho_0-1620927036306.png

The dynamic property I added becomes a new relationship on the processor.  So any FlowFile where content matches exactly "Merging complete" will be sent to this relationship while all other FlowFiles will be routed to the pre-existing "unmatched" relationship.

[1] http://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.13.2/org.apache.nifi.processors.standard.RouteText/index.html

[2] http://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.13.2/org.apache.nifi.processors.standard.RouteOnContent/index.html


If you found this help with your query, please take a moment to login and click accept on this solution.
Thank you,

Matt

2 replies

MattWho
Titanium ⭐️⭐️⭐️
MattWhoAnswer
Titanium ⭐️⭐️⭐️
May 13, 2021

@sangee 

The "RouteText" [1] processor is used to route individual lines within a multi-line content FlowFile to different relationships (essentially splitting up a multi-line FlowFile).  What you are trying to accomplish can however be done using the "RouteOnContent" [2] processor.

Your sample shows content with two lines and only one of those lines containing the string "Merging completed".  So I assume the other FlowFIle's content will have only one line with "Merging complete"?

If so, the "RouteOnContent" can be configured as follows:

MattWho_0-1620927036306.png

The dynamic property I added becomes a new relationship on the processor.  So any FlowFile where content matches exactly "Merging complete" will be sent to this relationship while all other FlowFiles will be routed to the pre-existing "unmatched" relationship.

[1] http://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.13.2/org.apache.nifi.processors.standard.RouteText/index.html

[2] http://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.13.2/org.apache.nifi.processors.standard.RouteOnContent/index.html


If you found this help with your query, please take a moment to login and click accept on this solution.
Thank you,

Matt

Translate
sangee
sangeeAuthor
Silver ⭐️
May 14, 2021
Thanks a lot
Translate