camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: TransactionErrorHandler, JMS, configuring retries
Date Tue, 14 Jun 2011 11:57:45 GMT
On Tue, Jun 14, 2011 at 12:45 PM, janne postilista
<> wrote:
> I have routes that read from JMS queue and write to another queue and
> do some processing in between. Queues are in external ActiveMQ server.
> I am confused about how error handling and configuring for example
> retries is configured.
> - my route is marked <transacted/> and because of that, it uses
> TransactionErrorHandler
> - states that
> "Configuration of Redelivery: The redelivery in transacted mode is not
> handled by Camel but by the backing system (the transaction manager).
> In such cases you should resort to the backing system how to configure
> the redelivery.". This I understand means that I configure "when
> exceptions happen, delivery is tried 10 times before moving message to
> dead letter queue" stuff to ActiveMQ, not Camel.
> - states that "As
> the TransactionErrorHandler also supports to let Camel do redeliveries
> you can use both worlds. Letting Camel do some redeliveries and at the
> end the backing transaction manager doing other redeliveries. In fact
> in the end the transaction manager have the final word. That means if
> Camel cannot process the exchange then its thrown back to the
> transaction manager that will perform the rollback, and redelivery.".
> This I understand means means TransactionErrorHandler does it's own
> redeliveries before ActiveMQ tries delivery?
> What if I configure 10 retries to both ActiveMQ and
> TransactionalErrorHandler, is message processing retries 10*10 = 100
> times if it throws an exception? Is that how it works?

Yes the TransactionErrorHandler used to not support Camel doing
redelivery, but thats added now.

When AMQ do redelivery, its a "all the way" redelivery, meaning when
an error occurs, the entire exchange rolls back.
And Camel will consume the message again - potentially using a new
thread etc. There is no state shared between the redelivery attempts
etc. Its only because AMQ put a flag on the message, that you know its
a redelivery. JMSRedelivered.

When Camel does redelivery, its a "fine grained" redelivery. As it
retries "where the error occurred". So if you have:

>From X
 to Y
 to Z

and the error occur at "to Z" then it only retry at that point.
However if AMQ does a redelivery, its "restarting".

You can pick and chose. Buts its recommended to keep it KISS.

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message