camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Zapletal <marco.zaple...@gmail.com>
Subject Re: Wait for transaction commit when putting messages on JMS queue using inOnly
Date Fri, 07 Sep 2012 13:30:00 GMT
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 <marco.zapletal@gmail.com> 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
>
>
>


Mime
View raw message