Created 09-25-2017 09:23 AM
I want to use routeonContent and put my response in deifferenct directories based on the method names they consist i have attribute '$message.body' and use expression( in routeonContent) ${message.body:contains('<person>')}
. But it doesn't work for me do you have any better idea how can i do this?
I need to check if it conatains tag with name person and if it does o will route it to certian direction.
I have replaced ${message.body:contains('<person>')} with this ${message.body:contains("<[^>][+ person+^>]*>")} but it still doesn't works.
Created on 09-26-2017 02:53 AM - edited 08-17-2019 10:43 PM
Route on content is to match the contents of ff we cannot compare attribute inside this processor.
But we can acheive by using
RouteOnAttribute Processor:-
as we are having ${message.body} as attribute then add a property
${message.body:contains('<person>')}
it will look for message.body attribute contains <person> or not.
if yes then it routes to person relation and
if ff not having <person> it will routes to unmatched relation.
RouteOnContent Processor:-
As you are having $message.body as attribute we are not able to use RouteOnContent processor, because it will look the content of ff to find match.
E.g:-How RouteOnContent works?
Input:-
<?xml version="1.0" encoding="UTF-8"?> <note> <person>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
If we are having the above input as the ff content then in Route on content processor we need to give property as
It will look for is the content of ff having <person> or not
In our case it is yes then it will route to person relation.
Created 09-25-2017 12:17 PM
See my answer to your earlier question. https://community.hortonworks.com/questions/139227/nifichecking-if-content-contains-xml-tag.html?chi...
Created on 09-26-2017 02:53 AM - edited 08-17-2019 10:43 PM
Route on content is to match the contents of ff we cannot compare attribute inside this processor.
But we can acheive by using
RouteOnAttribute Processor:-
as we are having ${message.body} as attribute then add a property
${message.body:contains('<person>')}
it will look for message.body attribute contains <person> or not.
if yes then it routes to person relation and
if ff not having <person> it will routes to unmatched relation.
RouteOnContent Processor:-
As you are having $message.body as attribute we are not able to use RouteOnContent processor, because it will look the content of ff to find match.
E.g:-How RouteOnContent works?
Input:-
<?xml version="1.0" encoding="UTF-8"?> <note> <person>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
If we are having the above input as the ff content then in Route on content processor we need to give property as
It will look for is the content of ff having <person> or not
In our case it is yes then it will route to person relation.