You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Thiago Souza <tc...@gmail.com> on 2010/10/22 16:22:03 UTC

Transaction Error Handler with Dead Letter Channel

Hi,

    Is there a way to configure (using java dsl) a transaction error handler
with a dead letter channel in case of a redeliver exhaustion?

Regards,
Thiago Souza
-- 
View this message in context: http://camel.465427.n5.nabble.com/Transaction-Error-Handler-with-Dead-Letter-Channel-tp3232320p3232320.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Transaction Error Handler with Dead Letter Channel

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Sep 21, 2011 at 10:48 AM, jason.parr <ja...@usa.net> wrote:
> Is this still the case that there is no way to specify a dead letter channel
> if you want to use a JTA/XA transaction spanning JMS & JDBC operations etc.
>
> If you many applications and all transactional failures get routed to the
> same spot, eg for activemq goto ActiveMQ.DLQ this would be unacceptable re:
> managing support for large organisations. Is there any way to configure the
> default DLQ on an application specific basis? If there is a solution within
> camel will it also work for Tibco EMS as this is the prod JMS
> infrastructure.
>

Apache ActiveMQ allows you to configure different DLQ queues.
For example as a prefix to the queue name where the message was stored.

See Apache ActiveMQ documentation for more details, such as:
http://activemq.apache.org/message-redelivery-and-dlq-handling.html
http://activemq.apache.org/redelivery-policy.html

Section 11.5 of the ActiveMQ in Action book also talks about DLQ queues.


> My code:
>
>        errorHandler(
>          transactionErrorHandler()
>        );
>
>        from("{{url.trades}}")
>          .transacted()
>          .to("log:com?level=INFO&showBody=true&showHeaders=false")
>          .setHeader("prevTradeVersion",
> bean("tradePersistence","queryTrade"))
>          .to("bean:tradeConsumer")
>          .beanRef("tradePersistence", "storeTrade")
>          .bean(SystemFailure.class);
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Transaction-Error-Handler-with-Dead-Letter-Channel-tp3232320p4825626.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Transaction Error Handler with Dead Letter Channel

Posted by "jason.parr" <ja...@usa.net>.
Is this still the case that there is no way to specify a dead letter channel
if you want to use a JTA/XA transaction spanning JMS & JDBC operations etc.

If you many applications and all transactional failures get routed to the
same spot, eg for activemq goto ActiveMQ.DLQ this would be unacceptable re:
managing support for large organisations. Is there any way to configure the
default DLQ on an application specific basis? If there is a solution within
camel will it also work for Tibco EMS as this is the prod JMS
infrastructure.

My code:

        errorHandler(
          transactionErrorHandler()
        );

        from("{{url.trades}}")
          .transacted()
          .to("log:com?level=INFO&showBody=true&showHeaders=false")
          .setHeader("prevTradeVersion",
bean("tradePersistence","queryTrade"))
          .to("bean:tradeConsumer")
          .beanRef("tradePersistence", "storeTrade")
          .bean(SystemFailure.class);


--
View this message in context: http://camel.465427.n5.nabble.com/Transaction-Error-Handler-with-Dead-Letter-Channel-tp3232320p4825626.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Transaction Error Handler with Dead Letter Channel

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Oct 22, 2010 at 5:39 PM, Thiago Souza <tc...@gmail.com> wrote:
>
> Hi,
>
>    So, if I can configure a redelivery policy at ActiveMQ AND at Camel,
> what would be the consequences of mixing different configurations?
>    Is it a good practice to isolate a redelivery policy configuration in
> one place only (that is, in amq OR in camel) ?
>

The problem is that when using the redelivery of the AMQ broker
(transaction and managed by transaction manager)
is that it often doesn't provide information that this is a
redelivery, or if it does, not the attempt number.
So you have a hard to keep track of how many times have I tried this
message before.
Remember when the message is being redelivered from AMQ it can be a
new thread processing it.
If you have a network of brokers the redelivery of the message could
potentially occur at another node etc.

With JMS spec there is the JMSRedelivered flag which is just a
boolean, so at least you know its a redelivery.
But I dont recall it have a attempt couter.
You can try to keep track of this yourself, and then handle the
exception in any way you like, and then let the transaction commit.

You can configure Camel error handler to use local redelivery attempts as well.
So you can have Camel retry invoking (let say invoking a web service).
But if it has to wait for redelivery then the thread is blocked
waiting).

The pro with the Camel error handler is that it only redeliveries at
the point of failure. Where as AMQ redelivery is "starting all over".



> Regards,
> Thiago Souza
> --
> View this message in context: http://camel.465427.n5.nabble.com/Transaction-Error-Handler-with-Dead-Letter-Channel-tp3232320p3232466.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Transaction Error Handler with Dead Letter Channel

Posted by Thiago Souza <tc...@gmail.com>.
Hi,

    So, if I can configure a redelivery policy at ActiveMQ AND at Camel,
what would be the consequences of mixing different configurations?
    Is it a good practice to isolate a redelivery policy configuration in
one place only (that is, in amq OR in camel) ?

Regards,
Thiago Souza
-- 
View this message in context: http://camel.465427.n5.nabble.com/Transaction-Error-Handler-with-Dead-Letter-Channel-tp3232320p3232466.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Transaction Error Handler with Dead Letter Channel

Posted by Donald Whytock <dw...@gmail.com>.
What about using DeadLetterChannelBuilder, like in the Error Handler page?

http://camel.apache.org/error-handler.html



On Fri, Oct 22, 2010 at 10:26 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Fri, Oct 22, 2010 at 4:22 PM, Thiago Souza <tc...@gmail.com> wrote:
>>
>> Hi,
>>
>>    Is there a way to configure (using java dsl) a transaction error handler
>> with a dead letter channel in case of a redeliver exhaustion?
>>
>
> No
>
> Usually the transaction manager has some way of a built-in dead letter channel.
> For example Apache ActiveMQ has that.
>
>
>> Regards,
>> Thiago Souza
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Transaction-Error-Handler-with-Dead-Letter-Channel-tp3232320p3232320.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Re: Transaction Error Handler with Dead Letter Channel

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Oct 22, 2010 at 4:22 PM, Thiago Souza <tc...@gmail.com> wrote:
>
> Hi,
>
>    Is there a way to configure (using java dsl) a transaction error handler
> with a dead letter channel in case of a redeliver exhaustion?
>

No

Usually the transaction manager has some way of a built-in dead letter channel.
For example Apache ActiveMQ has that.


> Regards,
> Thiago Souza
> --
> View this message in context: http://camel.465427.n5.nabble.com/Transaction-Error-Handler-with-Dead-Letter-Channel-tp3232320p3232320.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus