I have a camel endpoint where another application sends a post request with some data (Maybe with some other route)
I want to process this data and return something back to the application with the response of the POST request.
This is how my Camel Context looks at the moment:
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<restConfiguration component="restlet" bindingMode="json" port="8989" enableCORS="true"/>
<rest path="/finData">
<description>User rest service</description>
<post>
<to uri="direct:update"/>
</post>
</rest>
<route id="sendFinData">
<from uri="direct:update"/>
<log message="Got some data: ${body}"/>
<to uri="aclient://otherClient"/>
</route>
</camelContext>
How can I send some answer back from the route sendFinData through the response of the post request?
The response the post request to your route receives is whatever is in your ${body} at the end of the route.
So in your route's end the ${body} contains whatever is the response from
I don't use the Camel XML but in Java you would do:
If the data you want to pass back to the requester is not the response of last API call in your route you need to save it somewhere temporarily (exchange.properties) and set it back to body later, or aggregate the responses so that the original data does not get overwritten. The route should produce data that the consumer expects. For normal rest requests this should be String type (like "GoodBye world"). If you want to return JSON for example be sure that the response body is JSON string at the end of the route.
Sorry that I'm not able to help with the XML but hope this is of some help to you.