Hello Tim
I'm using v5.1 of the broker.
This is a little more interesting that I first thought.
Here is what I have now done.
I used Examples/Producers/SimpleProducer.cpp to put 2000 messages onto the
queue TEST.FOO.
I then ran up Examples/Consumers/SimpleAsyncConsumer.cpp in it's default
autoack mode and it consumed all 2000 messages off the queue.
I then modified it and made the following changes:
In RunConsumer
// Create a Session
/*
if( clientAck ) {
session = connection->createSession(
Session::CLIENT_ACKNOWLEDGE );
} else {
session = connection->createSession(
Session::AUTO_ACKNOWLEDGE );
}
*/
session = connection->createSession( Session::SESSION_TRANSACTED
);
This will force the session to be transactional
Then in onMessage
/*
if( clientAck ) {
message->acknowledge();
}
*/
this->session->commit();
When I then run the example - if looks like the messages are processed
normally but message #1 is left on the queue.
If I run the exe a second time it outputs message #1 to standard out but
looking at the queue in jconsole the message is still there.
I can keep running the exe over and over and it outputs message#1 to stdout
but never removes it off the queue. This is the situation I'm seeing in my
own project.
For completeness I went back to autoack and the message was consumed and
removed from the queue.
Hope this is of help.
kind regards
Richard
Timothy Bish wrote:
>
> Definitely sounds like there is something funny going on. What version
> of the broker are you using?
>
> If you could open a Jira issue and post a sample app that demonstrates
> the problem that would be useful.
>
> Regards
> Tin
>
> On Wed, 2008-08-20 at 09:11 -0700, Richard Gillingham wrote:
>>
>> Thanks for the reply.
>>
>> Yes I've got a consumer on the queue and see the message correctly come
>> in
>> to my message handler. I then do session.commit() but the message is
>> left
>> on the queue in flight. If I kill the session and restart the same
>> message
>> comes in off the queue again. If I switch back to autoacknowledge then
>> it
>> is removed from the queue.
>>
>> Any ideas?
>>
>> Richard
>>
>>
>> tabish121 wrote:
>> >
>> > As far as I know it works, do you have any consumers on the Queue?
>> >
>> >> -----Original Message-----
>> >> From: Richard Gillingham [mailto:[EMAIL PROTECTED]
>> >> Sent: Wednesday, August 20, 2008 10:51 AM
>> >> To: [email protected]
>> >> Subject: CPP: Do transactions work in CMS 2.2?
>> >>
>> >>
>> >> Hi
>> >>
>> >> I've swaped from AutoAcknowledge to transactional sessions and am
>> > seeing
>> >> all
>> >> messages get stuck on the queues. Even if I simply do a
>> > session->commit()
>> >> in the message handler the message remains inflight. Are transactions
>> >> working in CMS 2.2? Is there a fix I can apply?
>> >>
>> >> Thanks in advance
>> >>
>> >> Richard
>> >> --
>> >> View this message in context: http://www.nabble.com/CPP%3A-Do-
>> >> transactions-work-in-CMS-2.2--tp19069993p19069993.html
>> >> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>> >
>> >
>> >
>>
>
>
>
--
View this message in context:
http://www.nabble.com/CPP%3A-Do-transactions-work-in-CMS-2.2--tp19069993p19085623.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.