activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose María Zaragoza <demablo...@gmail.com>
Subject Re: can message.acknowledge be transacted?
Date Thu, 24 Jul 2014 20:00:37 GMT
2014-07-24 21:56 GMT+02:00 Timothy Bish <tabish121@gmail.com>:
> On 07/24/2014 03:37 PM, Jose María Zaragoza wrote:
>>
>> 2014-07-23 13:13 GMT+02:00 Gary Tully <gary.tully@gmail.com>:
>>>
>>> yes, but not in that way. message.acknowledge(); is not transactional.
>>> You need to manage the operations with a transacted session
>>> that is shared across the producer and consumer.
>>>
>>> consumer.receive();
>>> producer.send() ....
>>> session.commit()
>>
>>
>> A newbie question
>>
>> who performs session.commit() ? producer side or consumer side ?
>> if it's performed by producer side , does consumer send ACK to AMQ
>> broker ( to acknowledge all messages ) when producer commits it's
>> session ?
>>
>> Regards
>>
>>>
>>> On 23 July 2014 06:13, Kevin Burton <burton@spinn3r.com> wrote:
>>>>
>>>> I have a task processing a message, which creates about a dozen other
>>>> messages and then manually acknowledges the current message it's
>>>> processing.
>>>>
>>>> so it's like
>>>>
>>>> producer.send( message0 );
>>>> producer.send( message1 );
>>>> message.acknowledge();
>>>>
>>>> can I put those all in one transaction?
>>>>
>>>> --
>>>>
>>>> Founder/CEO Spinn3r.com
>>>> Location: *San Francisco, CA*
>>>> blog: http://burtonator.wordpress.com
>>>> … or check out my Google+ profile
>>>> <https://plus.google.com/102718274791889610666/posts>
>>>>   <http://spinn3r.com>
>>>
>>>
>>>
>>> --
>>> http://redhat.com
>>> http://blog.garytully.com
>
> Depends on what you are doing, if you are producing and consuming from the
> same application using producers and consumers creating from the same
> session then your application commits the session when it decides that all
> produced and consumed messages need to be committed (work is done).  If
> producer and consumer were created from different sessions then each session
> must have commit called when you decide it's time.
>
> For two different applications one producing and one consuming then each
> must commit on it's own, the producer commits when it's ready for all sent
> messages to be committed (messages are not dispatched to a consumer until
> the session is committed).  The consumer likewise must commit it's session
> once it has completed processing all the messages that your application
> decides comprise a unit of work.


Thanks a lot

>
> --
> Tim Bish
> Sr Software Engineer | RedHat Inc.
> tim.bish@redhat.com | www.fusesource.com | www.redhat.com
> skype: tabish121 | twitter: @tabish121
> blog: http://timbish.blogspot.com/
>

Mime
View raw message