You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by janne postilista <ja...@gmail.com> on 2011/06/14 12:45:10 UTC

TransactionErrorHandler, JMS, configuring retries

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
- http://camel.apache.org/transactional-client.html 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.
- http://camel.apache.org/transactionerrorhandler.html 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?

Re: TransactionErrorHandler, JMS, configuring retries

Posted by janne postilista <ja...@gmail.com>.
Thanks, that makes it more clear to me.

On Tue, Jun 14, 2011 at 2:57 PM, Claus Ibsen <cl...@gmail.com> wrote:
> On Tue, Jun 14, 2011 at 12:45 PM, janne postilista
> <ja...@gmail.com> 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
>> - http://camel.apache.org/transactional-client.html 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.
>> - http://camel.apache.org/transactionerrorhandler.html 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
> -----------------
> 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: TransactionErrorHandler, JMS, configuring retries

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jun 14, 2011 at 12:45 PM, janne postilista
<ja...@gmail.com> 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
> - http://camel.apache.org/transactional-client.html 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.
> - http://camel.apache.org/transactionerrorhandler.html 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
-----------------
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/