Hi Kevin I take a look on your Test. I think you have a little misunderstanding about the acknoledge. If you use transactional Session, the ack is send with the commit();. 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. Be aware of mMessagesRecieved > lMessagesSent. If all works fine the mMessagesRecieved will never be greater than lMessagesSent and so your code go to an infinit loop. 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 AUTO_ACKNOWLEDGE regards Marco kloh wrote: > > Hi Marco, > > > Marco Buss wrote: >> >> what acknoledge mode did you use? Session.AUTO_ACKNOWLEDGE? >> try to use Session.CLIENT_ACKNOWLEDGE an then send the ACK manualy. >> > we use transactional sessions, so no (??) acknowledge mode is used. > > > > Marco Buss wrote: >> >> I`t would be fine if you can provide a junit-test for the Problem. >> > I attached some classes with the activemq-5.1-jar and our > activemq-configuration file: > http://www.nabble.com/file/p17619600/JUnit.zip JUnit.zip > You have to change the url of the messagebroker in the 'config.java'-file. > Maybe you can play a bit with the values in the same file. The JUnit is in > the 'MainTest'-class. > > I appreciate your effort. > > Kevin > -- View this message in context: http://www.nabble.com/Closing-a-consumer-create-more-messages-than-sent-tp17602690s2354p17691428.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.