I'm having a similar problem.

I have a route that does some incorrect casting of body message.
M2 Throws ClassCastException wile M3 silently abort the operation and drops
the message.
when I step inside the M3 code with the debugger I can see that it's doing
some exception handling but shows nothing in the logs.
I'll try to get to it when I'll have more time.


J_Racker wrote:
> 
> I'm having a problem when setting up a route in camel.  In the process of
> debugging a new camel route I noticed that I could not connect to my
> Activemq Broker because of authentication.  So during the route when the
> message is sent to the queue, the following exception is thrown
> (javax.jms.JMSException: User broker is not authorized to write to:
> queue://).
> 
> According to the documentation if an exception happens during the route in
> camel 2, the exception should be propagated to the caller.  Here is the
> code that initiates the exchange
> 
> Exchange exchange = getEndpoint().createExchange();
> exchange.getIn().setBody(some_data);
> exchange.getIn().setHeader(MyHeader, MyHeaderValue);
> 
> try {
>       this.getProcessor().process(exchange);
> } catch (Exception e) {
>       log.error("Caught Exception during message forwarding.", e);
>       handleException(e);
> } 
> 
> The problem I'm seeing is that even though the route throws an exception
> this process method returns as if everything happened fine and my catch
> block isn't triggered.
> 
> In tracing through the camel code, I noticed that in the
> RedeliveryErrorHandler class on line 241 it calls:
> 
> OnExceptionDefinition exceptionPolicy = getExceptionPolicy(exchange, e);
> 
> which sets exceptionPolicy to null because I haven't set any exception
> policies.  According to the docs the default behavior should be to throw
> the exception to the caller, but instead it appears that because there is
> no exceptionPolicy that the handler simply returns after logging the
> failure
> 
> String msg = "Failed delivery for exchangeId: " + exchange.getExchangeId()
>                 + ". On delivery attempt: " + data.redeliveryCounter + "
> caught: " + e;
> logFailedDelivery(true, exchange, msg, data, e);
> 
> So in an attempt to solve this I added the following line to my route
> builder:
> 
> onException(java.lang.Exception.class).throwException(new
> RuntimeException("Exception in message processing"));
> 
> Now, when in the RedeliveryErrorHandler, this new exception policy is
> assigned and the failure processor is set to throw the RuntimeException. 
> However, the failure processor is also wrapped by the
> RedeliveryErrorHandler and when it throws the RuntimeException, the
> RedeliveryErrorHandler immediately grabs it, logs it, eats it, and returns
> as if everything is fine.
> 
> Am I using this exception handling framework in some way that it isn't
> meant to be used?  Is there a bug in the RedeliveryErrorHandler?  Any help
> would be appreciated.
> 
> Thank You
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Camel-2.0-M3-swalllowing-exceptions--tp24834025p24854572.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to