On 06.09.2012 11:33, Claus Ibsen wrote:
Hi

I assume the custom logic cannot participate in the same TX as the activeMQ?


Right. The custom logic should only execute upon successful completion of the transaction.



You can use onCompletion to store the monitoring after the routing has
completed. Then you can check if it was failed or not. And then only
store when not failed.
http://camel.apache.org/oncompletion.html

Thanks. We are using now onCompletion().onCompleteOnly()


However since the TX is using the same ActiveMQ to both consume + send
a message to it. Then there is a very slight slight slight chance that
the TX cannot complete.

Have you actually seen any situations where the TX could not commit?


Yes, in the past. We are using ActiveMQ with JDBC and there were situations where the connection to the DB was lost (when using the standard JDBC configuration). Then the commit failed in the first attempt, but succeeeded the second time resulting in executing the custom logic twice.




On Sat, Sep 1, 2012 at 4:04 PM, Marco Zapletal <[email protected]> wrote:
Hi Camel folks,


I have the following route configuration

from("activemq:q1").
transacted().
...
.inOnly("activemq:q2").
.inOnly("custom:storeMonitoringInformation")


The goal of the second .inOnly ("custom:storeMonitoringInformation") is to
store some monitoring information about the message after it was been
enqueued in q2. However, in case that the transaction commit fails (i.e.,
the message could not be inserted in q2), the monitoring entry is stored
anyway.

What is the recommended solution to deal with this issue - i.e., to wait for
a successful transaction commit before continuing with the route.

Thanks and best regards,

Marco




Reply via email to