I would like to use an integer value stored in the flowfile content for routing purpose.
The value comes from a select count(*) from <table>
earlier in the flow. This value is stored as content of the flowfile. Next, if the value > some_integer
I would like to route one way and if not, route to different path.
There is one way to do this by first collecting this value as an attribute of the flowfile and then using RouteOnAttribute processor. But Is there a way I can use RouteOnContent or RouteText to do the same? That way I will have two fewer processors.
Thanks
Yes, there is a way to use RouteOnContent processor for this solution. As you may know this processor matches the content using regex.
So, there will be two options that you can select in RouteOnContent processor :
1] content must match exactly : you can use this if your flowfile contains only the count from the previous query (integer) exclusively i.e there is no other data except that integer in the flowfile.
2] content must contain match : you can use this by matching regex with your field name or just the integer if there only single integer field in your flowfile.
Now add the route name on LHS and regex on RHS in both the cases:
Regex to match 0 to 255: \b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b
You can read more about such regex on this link
Considering complexity of this solution I would suggest you to collect it's value to flowfile attribute and use RouteOnAttribute. As 2 more processors won't cause you much harm.