Hi, you should use JmsTemplate to send messages only. Have a look at http://activemq.apache.org/jmstemplate-gotchas.html. You should use Spring's DefaultMessageListenerContainer to receive messages. We are using this, it works well.
Best regards, Martin On Wed, Oct 5, 2011 at 3:47 PM, James Black <be_st...@yahoo.co.uk> wrote: > Hello, > > we have an issue with our Spring application consuming from queues in > ActiveMQ. > > Versions: > > 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 = > 200. > > 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 > happen. > > 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: > http://activemq.2283324.n4.nabble.com/Spring-JmsTemplate-Messages-not-consumed-depending-on-session-ID-tp3874547p3874547.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. >