Hello ,
I am struggling with a strange issue using a simple deadLetterChannel error
handler with some onException clauses.

The route goes into an infinite loop, and debugging (going step by step in
the method "RedeliveryErrorHandler.processErrorHandler(exchange,
asynchcallback, data) ) 
I observe that the redelivery counter gets always reset to 0.

Here is my route:
{code}



        @Override
        public void configure() throws Exception {
                
                from(Constants.INBOUND_QUEUE)
                
                        .errorHandler(dlcb
                                .maximumRedeliveries(redeliveriesCount)
                                .useOriginalMessage()
                                .redeliveryDelay(redeliveryDelay)
                                .onRedelivery(
                                                new MyOwnLoggerProcessor(
                                                                "Message 
Redelivery in progress.")))

                
                .onException(MessageOutOfSyncException.class)
                                .useOriginalMessage()
                                .handled(true)
                                .maximumRedeliveries(redeliveriesCountOutOfSync)
                                .onRedelivery(
                                                new 
MyOwnLoggerProcessor("Requeueing message to "
                                                                + 
Constants.RDBMS_WRITES_INBOUND_QUEUE))

                                .to(Constants.INBOUND_QUEUE)
                        .end()

                // this message is duplicated, discard it to dead letter queue
                .onException(DuplicatedEventMessageException.class)
                                .useOriginalMessage()
                                .handled(true)
                                .process(
                                                new MyOwnLoggerProcessor(
                                                                "Sending 
duplicated message to dead letter queue"))
                                .to(dlcb.getDeadLetterUri())
                        .end()
                        
                .threads(routeExecutionThreadCountCount)

                .choice()
                                .when(body().isInstanceOf(Test1.class))
                                        .process(test1Processor)
                                
                                // otherwhise we send it to dead letter queue
                                .otherwise()
                                        .process(new 
MyOwnLoggerProcessor("Unhandled Message: "))
                                        .to(dlcb.getDeadLetterUri()).stop()

                ;

        }

{code}

The Dead Letter Queue Builder is constructed in the constructor of my class,
in this way:
{code}
dlcb = new DeadLetterChannelBuilder(
                                Constants.INBOUND_QUEUE + "/deadLetter");
                dlcb.setFailureProcessor(new MyOwnLoggerProcessor(
                                "Message Delivery Failure"));

{code}

Can someone help me figuring out what's happening ?

Thanks a lot in advance.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-2-9-1-DeadLetterChannel-infinite-loop-tp5714961.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to