activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Chobot <bcho...@vigilos.com>
Subject AUTO_ACKNOWLEDGE, asynchronous consumers, and avoiding duplicate messages
Date Wed, 20 Feb 2008 21:10:35 GMT
I'm reading over Sun's JMS tutorial and it mentions several times that 
JMS (and therefore ActiveMQ) can keep out duplicate messages if 
consumers set their session to AUTO_ACKNOWLEDGE. But I don't see how 
that's always the case. Consider this timeline:

1. Consumer registers an asynchronous listener for a queue.
2. Producer injects a persistent message into said queue.
3. Consumer's onMessage() is called and the message is processed.
4. Broker crashes.
5. Consumer tries to ack the message is just successfully processed - 
woops. Consumer tears down its session.
6. Broker comes back online; consumer reconnects, re-registers its 
asynchronous listener.
7. Consumer gets a duplicate message.

What am I missing?

Mime
View raw message