Question

I created a camel route without INOUT exchange pattern and the route looks like

direct:start > bean:myBean?method=handle

I'm sending payload using ProducerTemplate's send method

Exchange response = producerTemplate.send(endpointUri, exchange);

I set the exception on exchange in the bean's handle method, but its not retained in the response.

Is there something I'm missing.

Was it helpful?

Solution 2

I found where camel's hiding the exception. Since I marked the exchange as handled and marked for rollback, camel is setting the exception to null and moved it to properties.

I was able to retrieve it using

result.getProperty(Exchange.EXCEPTION_CAUGHT)

OTHER TIPS

You should throw an exception from the bean if you want to signal an exception.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top