activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Black <>
Subject Spring JmsTemplate Messages not consumed depending on session ID
Date Wed, 05 Oct 2011 13:47:58 GMT

we have an issue with our Spring application consuming from queues in


Spring 3.0.5
ActiveMQ 5.5.0
All messages are persistent.

We have a need to throttle the rate at which messages are consumed from 1
part of our application therefore we use the jmsTemplate to consume from a
queue in this part.  For the rest of our application the DMLC is used as
normal.  The DMLC seems to be operating as normal.

There may be multiple instances of these elements and they all share the
same JmsTemplate to receive messages with.

The JmsTemplate uses the Spring CachingConnectionFactory with sessionCache =

For these elements they may consume from different queues or the same queue. 
Many combinations are possible.

Our issue is that with prefetch left on at the default (1000) or even set to
1 we are seeing messages sticking on the queues.

Looking at the debug or trace log information we can see that the session
that a jmsTemplate gets will depend whether a message is retrieved from the
queue or not.

I believe that the prefetch has delivered the missing messages to a session
that is back in the pool.  With prefetch=0 the problem does not appear to

Is this the behaviour that we should expect?

When do the prefetch messages get returned to ActiveMQ?  I though the
closing of the session by jmsTemplate would return the messages?

Thanks any help appreciated :>

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

View raw message