How to update Camel exchange message body inside Camel Route running inside SwitchYard ?
Issue
- How to update a
Camel Exchange message bodydepending on a certain value retrieved from theCamel message body(exchange) inside aCamel XML route?
e.g.
<choice>
<when>
<simple>${body.prop1} == 'TEST'</simple>
body.prop2="TEST"
<to uri="switchyard://SimpleService?operationName=simpleOperation" />
</when>
</choice>
- Just to clarify the requirement here is what is expected from this use case.
- User is trying to run the aforementioned
Camel route (XML)from inside a Camel Component of SwitchYard application. - Inside the Camel route (XML) user wants to analyze the body part of the incoming Camel Exchange message , which are in key-value pair.
- Now inside the same route user is checking if inside the same message body if a key named
prop1contains value asTEST, then it would update the value of another keyprop2found inside the same message with value 'TEST' .
-
If the incoming and outgoing message inside
Camel routeis inJSONformat, what would be the way to change the value as per above requirement?
To clarify the requirement further, user wants to sendJSONrequests to theREST composite bindingof theSwitchYardapplication and receive updatedJSON response. -
Also, is there a way to implement the above mentioned requirement all inside the
Camel Routeitself, not from any other bean or external classes?
Environment
- Red Hat JBoss Fuse Service Works (FSW)
- 6.0.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
