activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kloh <>
Subject Re: Closing a consumer create more messages than sent
Date Fri, 06 Jun 2008 12:59:30 GMT


thanks for having time for looking at it!

Marco Buss wrote:
> Be aware of mMessagesRecieved > lMessagesSent
Yes, sorry for that. It has to be '>='!

> The problem in your code is the closing and creating of a new consumer. If
> you close the old one, he had not enough time to send the ack for the last
> message. So the broker thinks the Message is lost or there are another
> problem and he sneds the message twice to the new consumer.
> I have insert a little break after the closing of the consumer before the
> new consumer is created. After that all works like you expected.
But is this the correct way? I mean, to make just a little pause after
closing isn't a nice way, is it? I can't imagine, that the
ActiveMQ-developers want this to be done by a user...

> Another way is to say explicit the no ack is needed. To do that change
> your connector.
> mConnFact = new ActiveMQConnectionFactory(DEFAULT_URL);
> 	((ActiveMQConnectionFactory)mConnFact).setAlwaysSessionAsync(true);
> 	((ActiveMQConnectionFactory)mConnFact).setUseAsyncSend(true);
> 	((ActiveMQConnectionFactory)mConnFact).setDispatchAsync(true);
> I`m not shure if you need all the three. Try it out. A have also changed
> the consumer a little bit for that.
> mJMSSession = mConnector.lookupConnection().createSession(false,
> 					Session.AUTO_ACKNOWLEDGE);
> also i have rmoved the commit(); because it is not needed with
No, thats no option! We do use transactions and don't want to change it!

Thanks for the reply, I'll give the pause after closing one consumer a
chance but I'm not happy with it!

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message