One-way route waiting on a request-response endpoint
Assume that you have a route that uses the InOnly
Message Exchange Pattern (MEP). The consumer that fed a message into the route expects no response. Any endpoint listed in the route will, as a consequence, be invoked with the InOnly
MEP.
This recipe shows how you can alter the MEP temporarily to InOut
in order to request a response from an endpoint used in a one-way route.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.routing.changingmep
package. The Spring XML files are located under src/main/resources/META-INF/spring
and prefixed with changingMep
.
How to do it...
Use the inOut
DSL statement to explicitly route a message to that endpoint with that specific MEP.
In the XML DSL, this logic is written as follows:
<route>
<from uri="direct:in"/>
<inOut uri="direct:modifyMessage"/>
<to uri="mock:afterMessageModified"/>
</route>
Tip
The Endpoint invocation could also be written as...