You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Bruce Snyder <br...@gmail.com> on 2010/02/16 04:46:17 UTC

Re: 50k + messages stuck in queue with all consumers blocking on receive

On Mon, Feb 15, 2010 at 4:41 AM, Maarten_D <ma...@gmail.com> wrote:
>
> Hi Rob,
> Sorry, I'd killed that particular JVM before I read your request, and the
> error hasn't reoccurred since then.
> Something else that I've been thinking about since reading a
> http://tmielke.blogspot.com/2009/12/using-spring-jms-template-for-sending.html
> blog post : we used the ActiveMQ PooledConnectionFactory for establishing
> all connections to the broker, for the Spring message listener containers as
> well as for the JMS templates.
> After diving into the code of the PooledconnectionFactory, this seems to
> have been a bad idea. When a connection is requested, the PCF simply creates
> a new one and hands it out. When the pool is full, it returns the first
> connection in its list (ie the first one it created), removes it from the
> top of the list and adds it to the bottom. This means that, if your
> listeners also get connections from this pool (and remember, listeners hold
> on to their connections), a whole bunch of JMS template calls will be made
> where the template is sending messages using the same connector used by a
> listener.
> I'm not too sure about the details, but when you introduce
> producerflowcontrol into this picture, I can imagine how a kind of deadlock
> can occur where eventually all producers on all connections are throttled,
> leaving no one able to send any messages.
> Does this sound like a plausible scenario?
>
> We've modified our config and given all listener containers a connection
> that's not in the pool, and are now running another test. I'll post the
> results.
>
> Regards,
> Maarten
>
> PS. Of course, you might say we should've know about this beforehand, as the
> PCF javadoc says that its not really meant for consumers. The alternative it
> offers is Jencks, although that project has been dead for a while, to the
> point where even the homepage is now a spam site (jencks.org). So clearly
> that isn't a viable alternative.

FWIW, the Spring CachingConnectionFactory is an excellent alternative
for connection caching with message producers, especially with the
Spring JmsTemplate:

http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/connection/CachingConnectionFactory.html

For message consumption, the Spring DefaultMessageListenerContainer
offers caching of connections, sessions and consumers:

http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/listener/DefaultMessageListenerContainer.html

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

ActiveMQ in Action: http://bit.ly/2je6cQ
Blog: http://bruceblog.org/
Twitter: http://twitter.com/brucesnyder