A bug in camel leads to the situation that a Camel route like the following is not returned to the caller.
onException(Exception.class)
.handled(true)
.transform()
.simple("Error reported: $
{exception.message}
- cannot process this message.")
;
from("switchyard://OnExceptionService")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception
{
throw new Exception("Mock Exception");
}
});
I could track the behaviour down to the class org.switchyard.bus.camel.CamelExchangeBusRouteBuilder which uses a camel try-catch-finally block to handle exceptions for the routing of switchyard services. The finally block consists of two Processors:
InterceptProcessor
ConsumerCallbackProcessor
Due to a camel bug see #1 only the first processor of a finally block is executed. The second processor, which returns the exchange to the caller, is ommited, as camel thinks some other exception happened.
A possible workaround would be the addition of another processor that removes the Exchange.ERRORHANDLER_HANDLED property from the exchange or the upgrade the version of camel.
#1 http://stackoverflow.com/questions/20399863/if-route-threw-exception-and-handled-is-set-to-true-only-first-processor-in-dof
|