How to update Camel exchange message body inside Camel Route running inside SwitchYard ?

Solution Unverified - Updated -

Issue

  • How to update a Camel Exchange message body depending on a certain value retrieved from the Camel message body (exchange) inside a Camel 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.
  1. User is trying to run the aforementioned Camel route (XML) from inside a Camel Component of SwitchYard application.
  2. Inside the Camel route (XML) user wants to analyze the body part of the incoming Camel Exchange message , which are in key-value pair.
  3. Now inside the same route user is checking if inside the same message body if a key named prop1 contains value as TEST , then it would update the value of another key prop2 found inside the same message with value 'TEST' .
  • If the incoming and outgoing message inside Camel route is in JSON format, what would be the way to change the value as per above requirement?
    To clarify the requirement further, user wants to send JSON requests to the REST composite binding of the SwitchYard application and receive updated JSON response.

  • Also, is there a way to implement the above mentioned requirement all inside the Camel Route itself, 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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content