activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashish <ashishdhawan...@gmail.com>
Subject Point-to-Point Model - Multiple Consumers - ActiveMQ - 5.3.2
Date Thu, 21 Jul 2011 16:28:31 GMT
Hi,

I have the following scenario where multiple consumers poll the same queue
to retrieve messages in a point to point model. The acknowledgment mode
being used is: Individual_Acknowledge

My requirement is that the message should be processed only once.

 From what I understand:  If a consumer has retrieved a message which has
not been acknowledged yet then the other consumers will not be to retrieve
this message till the session of the first consumer is closed. 
*
Is my understanding correct? *

I ran a couple of threads which retrieve messages from the queue (the queue
has only one message). Both threads do not acknowledge the message. The
first thread runs every 60 sec while the second thread runs every 20
sec.Each thread creates a separate connection to ActiveMQ. Each thread tries
to retrieve the messages before it sleeps and disconnects the session after
it finishes sleeping.

Following is the output of this program. The first thread retrieves the
message first.While it is holding the session, the second thread does not
retrieve a message but when the first thread releases the connection, none
of the threads immediately pick up the message again. It is a while before a
thread picks up the message. 

*I wanted to know as to why this is happening?*


FIRST - NUMBER OF MESSAGES RETRIEVED: 1
SECOND - NO MESSAGES RETRIEVED
SECOND - CLOSED CONNECTION
SECOND - NO MESSAGES RETRIEVED
SECOND - CLOSED CONNECTION
SECOND - NO MESSAGES RETRIEVED
*FIRST - CLOSED CONNECTION
FIRST - NO MESSAGES RETRIEVED
SECOND - CLOSED CONNECTION
SECOND - NO MESSAGES RETRIEVED
SECOND - CLOSED CONNECTION
SECOND - NO MESSAGES RETRIEVED
SECOND - CLOSED CONNECTION*
SECOND - NUMBER OF MESSAGES RETRIEVED: 1
FIRST - CLOSED CONNECTION
FIRST - NO MESSAGES RETRIEVED
SECOND - CLOSED CONNECTION
SECOND - NO MESSAGES RETRIEVED
SECOND - CLOSED CONNECTION
SECOND - NO MESSAGES RETRIEVED



-Ashish
















-Ashish

--
View this message in context: http://activemq.2283324.n4.nabble.com/Point-to-Point-Model-Multiple-Consumers-ActiveMQ-5-3-2-tp3684188p3684188.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message