Pregunta

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.

¿Fue útil?

Solución 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)

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top