Hi Rafal,

please try handled(false);

My understanding is that then the error handler is called. However, I do
not understand why the first example with handled(true) works.

Regards Franz Forsthofer
--------------------------
SAP AG
e-mail: franz.forstho...@sap.com


On Tue, May 14, 2013 at 10:53 PM, rafaljaw <rafal...@gmail.com> wrote:

> Hi all,
>
> I have simple route that takes messages from [Input] and forwards them to
> [Output], or to [Failed] (dead letter queue) if something bad happens:
>
>     errorHandler(deadLetterChannel("jms:queue:Failed")
>         .maximumRedeliveries(1)
>         .redeliveryDelay(0));
>
>     onException(Throwable.class)
>         .maximumRedeliveries(0)
>         .handled(true);
>
>     from("jms:queue:Input")
>         .process(new Processor() {
>             @Override
>             public void process(Exchange exchange) throws Exception {
>                 System.out.println("Processing msg " +
> exchange.getIn().getBody());
>                 throw new RuntimeException("Something bad happens
> here...");
>             }
>         })
>         .to("jms:queue:Output");
>
> Everything works as expected - all messages are placed on [Failed] queue
> since we are throwing RuntimeException in processor. But it doesn't work
> after adding processor to onException:
>
>
>     errorHandler(deadLetterChannel("jms:queue:Failed")
>         .maximumRedeliveries(1)
>         .redeliveryDelay(0));
>
>     onException(Throwable.class)
>         .maximumRedeliveries(0)
>         .process(new Processor() {
>             @Override
>             public void process(Exchange exchange) throws Exception {
>                 System.out.println("Exception is intercepted...");
>             }
>         })
>         .handled(true);
>
>     from("jms:queue:Input")
>         .process(new Processor() {
>             @Override
>             public void process(Exchange exchange) throws Exception {
>                 System.out.println("Processing msg " +
> exchange.getIn().getBody());
>                 throw new RuntimeException("Something bad happens
> here...");
>             }
>         })
>         .to("jms:queue:Output");
>
> I'm loosing all messages now - why? Why adding processor to onException is
> so special?
> I'm using Camel 2.6 and ActiveMQ 5.8.0.
>
> Regards,
> Rafal
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Why-dead-letter-channel-doesn-t-work-after-adding-Processor-to-onException-tp5732535.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to