activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kpalania <>
Subject Re: Spring JmsTemplate receive() returns null with messages in Queue
Date Tue, 21 Oct 2008 19:16:30 GMT

I am running onto the same issue as well with ActiveMQ 5.1 and Spring 2.5. If
I don't use JmsTemplate or use it but do a blocking call, it is fine.
However, I am unable to use JmsTemplate with it being non-blocking. Any

Yohan Liyanage wrote:
> Hi,
> I tried to use JmsTemplate's receive() method for synchronous consumption
> of a Queue, but the method returns 'null', even when there are messages in
> the queue.
> The JmsTemplate (with a time out of two seconds) successfully receives
> first messages, but after a while, it is not able to consume messages from
> the queue, and returns null (timeout), even when there are messages in the
> Queue (I checked through JMX).
> Then I tried using RECEIVE_TIMEOUT_INDEFINITE_WAIT, and with that, I was
> able to consume about 7,8 messages (out of 50) and again, it fails
> returning null. Then I tried out with NO_WAIT and this time, I was only
> able to consume first message. It fails returning nulls.
> I tried this with CachingConnectionFactory / SingleConnectionFactory and
> also with direct ActiveMQ  ConnectionFactory. But the result is same. The
> application consumes several messages, and then starts to return null,
> while there are messages left in queue.
> I am using Spring 2.5.5 with ActiveMQ 5.1.
> Any suggestions are deeply appreciated.
> Thanks
> PS: I tried this with asynchronous message consumption using
> MessageListener and DefaultMessageListenerContainer, and it works as
> expected without this issue. 

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

View raw message