error in DeadLetterChannel propagated to source

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

error in DeadLetterChannel propagated to source

Josef Ludvíček
Hello camel users,

I'd like to ask you for your opinion on following DeadLetter channel example.
Is it bug, feature or I'm missing something?

I create route with DeadLetter error handler.
On error message goes to route "dead-letter-route".
 - use case: format some meaningfull description of problem and send e-mail to admin or
whatever
 - there is LoggingErrorHandler for dead-letter-route route -if sending mail / templating /
whatever fails, I need to know what happend, maby try redelivery.


In following example:
 - new e-mail in source-route
 - http post fails
 - message is moved to dead-letter-route
 - http post in dead-letter-route fails
 - I expect error to be logged and it should be end of story BUT
 - error is propagated back to source-route and to imap endpoint, which results to e-mail being
marked as unread => inifnite loop. Shouldn't dead letter channel in original route prevent such
situations?

Tried with camel 2.12.0 and 2.13.0.

Thanks for opinion.

Josef


--- spring xml --- dependencies: camel-mail, camel-http4
------------------------------------------

<camel:camelContext xmlns="http://camel.apache.org/schema/spring">


        <camel:errorHandler id="source-route-eh" type="DeadLetterChannel"
deadLetterUri="direct:dead">
            <camel:redeliveryPolicy maximumRedeliveries="2" logStackTrace="false"
                                    logRetryAttempted="true" logExhausted="true"
retryAttemptedLogLevel="WARN"
                                    retriesExhaustedLogLevel="ERROR"/>
        </camel:errorHandler>


        <camel:errorHandler id="logging-dead-route" type="LoggingErrorHandler">
            <camel:redeliveryPolicy maximumRedeliveries="1"
                                    logRetryAttempted="true" logExhausted="true"
retryAttemptedLogLevel="WARN"
                                    retriesExhaustedLogLevel="ERROR" logStackTrace="false"/>
        </camel:errorHandler>

        <camel:route id="source-route" errorHandlerRef="source-route-eh">
            <camel:from
uri="imaps:[hidden email]?password=USER_PASSWORD&amp;consumer.delay=
1000"/>
            <!--<camel:from uri="quartz2:tests/test?trigger.repeatCount=0"/>-->
            <camel:to uri="http4://localhost:666/nonexistinguri"/>
        </camel:route>

        <camel:route id="dead-letter-route" errorHandlerRef="logging-dead-route">
            <camel:from uri="direct:dead"/>
            <camel:log message="message in dead letter queue"/>
            <camel:to uri="http4://localhost:667/deadnonexistinguri"/>
        </camel:route>

    </camel:camelContext>
---------------------------------