AMQ_SCHEDULED_DELAY and transactional boundaries

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

AMQ_SCHEDULED_DELAY and transactional boundaries

arkin
I have observed that when sending delayed delivery messages (with AMQ_SCHEDULED_DELAY values in the header), ActiveMQ does not seem to be including the delivery in the original transaction. This results in duplicate messages being delivered in my setup. Here is how I tested:
1. Send a message to a Q1.
2.a Consumer starts a transaction and reads message from Q1.
2.b Consumer sends the message to a retry queue Q2 with AMQ_SCHEDULED_DELAY header in the same transaction.
2.c Consumer crashes before it can commit the transaction.
But I can see both messages after AMQ_SCHEDULED_DELAY despite the transaction not being committed. So first message was not dequeued from Q1, since the transaction was not committed, but the second message is delivered to Q2 despite the transaction not being committed.

When I try the same test without the delay, the second message does not get delivered as expected. This makes me think that my transaction management is ok.

I could not find anything that indicates that delayed/scheduled delivery of messages will not participate in transactions in docs or on forums. So I wanted to check with the experts what the expected behavior is.

Thanks for your help in advance.
Reply | Threaded
Open this post in threaded view
|

Re: AMQ_SCHEDULED_DELAY and transactional boundaries

tabish121@gmail.com
On Fri, 2012-10-26 at 17:41 -0700, arkin wrote:

> I have observed that when sending delayed delivery messages (with
> AMQ_SCHEDULED_DELAY values in the header), ActiveMQ does not seem to be
> including the delivery in the original transaction. This results in
> duplicate messages being delivered in my setup. Here is how I tested:
> 1. Send a message to a Q1.
> 2.a Consumer starts a transaction and reads message from Q1.
> 2.b Consumer sends the message to a retry queue Q2 with AMQ_SCHEDULED_DELAY
> header in the same transaction.
> 2.c Consumer crashes before it can commit the transaction.
> But I can see both messages after AMQ_SCHEDULED_DELAY despite the
> transaction not being committed. So first message was not dequeued from Q1,
> since the transaction was not committed, but the second message is delivered
> to Q2 despite the transaction not being committed.
>
> When I try the same test without the delay, the second message does not get
> delivered as expected. This makes me think that my transaction management is
> ok.
>
> I could not find anything that indicates that delayed/scheduled delivery of
> messages will not participate in transactions in docs or on forums. So I
> wanted to check with the experts what the expected behavior is.
>

Messages sent to the scheduler aren't included in the transaction bounds
currently since they can be set to fire at some far off time in the
future there's no way for them to be linked to the transaction.  

> Thanks for your help in advance.
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/AMQ-SCHEDULED-DELAY-and-transactional-boundaries-tp4658339.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.

--
Tim Bish
Sr Software Engineer | RedHat Inc.
[hidden email] | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/

Reply | Threaded
Open this post in threaded view
|

Re: AMQ_SCHEDULED_DELAY and transactional boundaries

johnsimons
Hi Tim,

Just to clarify.
The issue is not that the "callback/delayed" message is not part of the transaction.
The issue is that the actual enqueuing of the message with AMQ_SCHEDULED_DELAY is not part of the ambient transaction.

Hope this clarifies our problem.

Regards
John