Hi

You need to use handled(true) in your onException block.

On Wed, Apr 23, 2014 at 7:21 PM, ninadmnaik <[email protected]> wrote:
> Hello,
>
> We are using "consumer.bridgeErrorHandler=true" in our route, so that if
> there's an exception during picking up of files, the Camel Error Handler can
> deal with it.
>
> It appears from the documentation and code snippet at:
> http://camel.apache.org/file2.html (Using consumer.bridgeErrorHandler
> section) that if there's an error picking up files, the "onException" clause
> will be invoked and will continue to execute the ".to("mock:error") clause.
>
> However, in our case, the "onException" clause is invoked, however the ".to"
> clause isn't. Here's how our code looks like:
>
>       onException(SomeException.class).process(new Processor()
>       {
>          @Override
>          public void process(Exchange exchange)
>          {
>          //Do some logging, processing etc.
>          }
>       }).to("direct:sendEmail");
>
> So, in the above code the ".to("direct:sendEmail")" part is never invoked.
>
> While I was debugging this, I found out that in
> BridgeExceptionHandlerToErrorHandler.java#handleException(String message,
> Exchange exchange, Throwable exception), Exchange.REDELIVERY_EXHAUSTED is
> set to true on Exchange:
>        // and mark as redelivery exhausted as we cannot do redeliveries
>         exchange.setProperty(Exchange.REDELIVERY_EXHAUSTED, Boolean.TRUE);
>
> This causes this exchange to get marked as "exhausted" in
> RedeliveryErrorHandler.java#processErrorHandler(final Exchange exchange,
> final AsyncCallback callback, final RedeliveryData data) and the
> ".to("direct:sendEmail")" part of the route is never processed.
>
> This isn't compliant with the documentation.
>
> So, the question is: do we need to set another property on the route to
> execute the complete route? Currently, we are just removing
> "Exchange.REDELIVERY_EXHAUSTED" from the exchange in our onException clause
>
>       onException(SomeException.class).process(new Processor()
>       {
>          @Override
>          public void process(Exchange exchange)
>          {
>              exchange.getProperties().remove(Exchange.REDELIVERY_EXHAUSTED);
>
>          }
>       }).to("direct:sendEmail");
>
>
>
>
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Using-consumer-bridgeErrorHandler-won-t-allow-onException-route-to-execute-completely-tp5750507.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [email protected]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Reply via email to