Search code examples
javaloggingrequestapache-camelresponse

Camel InOut log both in and out


I have a route defined as such using a route definition in java:

routeDefinition = from("someLocation");
routeDefinition.setExchangePattern(ExchangePattern.InOut);
routeDefinition.to("log:camel.logging?level=INFO&showOut=true");
routeDefinition.to("someOtherLocation");
routeDefinition.routeId("someId");

The message is consumed and responded to as expected, but when I look at the log the "Out" message is always null i.e.

camel - Exchange[ExchangePattern:InOut, BodyType:String, Body:{"timestamp":1393602518590,"headers":{"JMSCorrelationID":"54783292"},"data":{...}}, Out: null]

How can I log both the incoming and outgoing message?


Solution

  • Forget about the OUT as the FAQ says.

    If you add the log at the end of the route, then what the log output in IN i what is returned to the client.

    Its the pipes and filters principle http://camel.apache.org/pipes-and-filters.html