You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bing Lu <mf...@yahoo.com.INVALID> on 2020/08/15 14:20:05 UTC

deadletterchannel

 what options do i need to use on deadletterchannel so the messages going there show both original message as well as the caught exception and stacktrace? thanks

Re: deadletterchannel

Posted by Bing Lu <mf...@yahoo.com.INVALID>.
 thank you very much, gonna try this.
    On Saturday, August 15, 2020, 10:40:29 AM EDT, Mikael Andersson <mi...@protonmail.com.invalid> wrote:  
 
 We use this:


        errorHandler(deadLetterChannel("{{jms.queue.dead}}")
            .logHandled(true)
            .maximumRedeliveries(0)
            .disableRedelivery()
            .logExhaustedMessageBody(true)
            .logExhaustedMessageHistory(true)
            .useOriginalMessage()
            .log("Error logged in File Importer")
            .onPrepareFailure(exchange -> {
                final Exception cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
                log.error("Error occurred in File Importer", cause);
                exchange.getIn().setHeader("FailedBecause", cause.getMessage());
                exchange.getIn().setHeader("CamelJmsMessageType", JmsMessageType.Text);

            })
        );


_____
/M

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday 15 August 2020 kl. 16:20, Bing Lu <mf...@yahoo.com.INVALID> wrote:

> what options do i need to use on deadletterchannel so the messages going there show both original message as well as the caught exception and stacktrace? thanks

  

Re: deadletterchannel

Posted by Mikael Andersson <mi...@protonmail.com.INVALID>.
We use this:


        errorHandler(deadLetterChannel("{{jms.queue.dead}}")
            .logHandled(true)
            .maximumRedeliveries(0)
            .disableRedelivery()
            .logExhaustedMessageBody(true)
            .logExhaustedMessageHistory(true)
            .useOriginalMessage()
            .log("Error logged in File Importer")
            .onPrepareFailure(exchange -> {
                final Exception cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
                log.error("Error occurred in File Importer", cause);
                exchange.getIn().setHeader("FailedBecause", cause.getMessage());
                exchange.getIn().setHeader("CamelJmsMessageType", JmsMessageType.Text);

            })
        );


_____
/M

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday 15 August 2020 kl. 16:20, Bing Lu <mf...@yahoo.com.INVALID> wrote:

> what options do i need to use on deadletterchannel so the messages going there show both original message as well as the caught exception and stacktrace? thanks