I seem to be having problems with 'stuck' messages on a queue.
I am running with the latest ActiveMQ release. I have noticed this both
when the server runs on Windows or Linux.
My message frequency is very low, around 1 message every 10 seconds and the
messages are small.
For this test scenario, I have one multi-threaded client pulling from a
single queue. I start my test producer to send a single small text message
once every 10 seconds. I have a multi-threaded ( 5 threads ) client
listening on the queue and just prints the message ID so I can see that they
are not all being consumed. Each thread creates its own transacted Session.
There is a connection pool of 3 connections which is shared across the 5
threads, in this case.
As messages are pulled from the queue, the message ID is printed and that is
all for now. I can see blocks of messages not being consumed.
There seems to be a pattern of the number of missed messages to the number
of client threads. For example message 60, 66,
67,68,69,70,76,77,78,79,80,86,87,88,89,90,96, etc are pulled. And as I
mentioned I have 5 client threads.
I tried to set the prefetch size like:
queue.simpleMsgQueue=simpleMsgRcvQueue?consumer.prefetchSize=1
which I then use like:
session =
connectionFactory.createConnection().createSession(true,
Session.SESSION_TRANSACTED);
Queue readQueue = new ActiveMQQueue(readQueueName);
messageConsumer = session.createConsumer(readQueue);
my processing loop looks like:
public void run() {
while( isRunning() ) {
try {
receiveSync(); // basically does consumer.receive(5000)
session.commit();
} catch( ShutdownException se ) {
log.error(se.getMessage(),se);
} catch(Exception e ) {
log.error(e.getMessage(),e);
session.rollback();
}
}
}
I also started the server with the following config:
<policyEntry queue="simpleMsgRcvQueue">
<dispatchPolicy>
<roundRobinDispatchPolicy/>
</dispatchPolicy>
</policyEntry>
The messages are not persistent. I can run the browse command and see the
messages in the server.
The client was written to call receive(5000); timeout because the client has
to check from time to time to see if it needs to do something else so the
client threads pull from the server, the server does not push to the
clients.
If I restart my client, the client will pick up the messages upon startup.
I saw a bug report about non-delivered queue messages but it said it was
fixed in 4.1. Does anyone know if that is in the latest binary download?
Any suggestions on why I can try?
Thanks in advance for any help and thoughts.
--
View this message in context:
http://www.nabble.com/Messages-%27stuck%27-on-queue%2C-until-client-restart-tf3017349.html#a8379662
Sent from the ActiveMQ - User mailing list archive at Nabble.com.