Camel message body becomes null when sent to error queue in onException() method.
Issue
I have following camel route:
String destination = "cxf:http://localhost:9090/test?dataFormat=MESSAGE";
from("jms:queue:dslSource")
.onException(java.net.ConnectException.class, Exception.class)
.maximumRedeliveries(3)
.maximumRedeliveryDelay(3000)
.retryAttemptedLogLevel(LoggingLevel.INFO)
.log(LoggingLevel.WARN, "Failed to send message ${body}") // body is not null here
.log(LoggingLevel.WARN, "Sending message to the error queue: ${body}") // body is null here
.to("jms:queue:dslError")
.end()
.log(LoggingLevel.INFO, "Sending message ...")
.setHeader("bridgeDestination", constant(destination))
.to(destination)
.log(LoggingLevel.INFO, "received back: ${body}")
.routeId("example-dsl");
If an exception is thrown, for instance, a ConnectionException due to unavailability of the backend web service, the onException() route will be executed. The first log endpoint:
.log(LoggingLevel.WARN, "Failed to send message ${body}")
prints out camel exchange IN message body without any problem. However, the second log endpoint:
.log(LoggingLevel.WARN, "Sending message to the error queue: ${body}")
prints out a "Sending message to the error queue: null".
Any reason why the message body becomes a null in this case?
Environment
- JBoss Fuse 6.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.
