JMX meets the DefaultMessageListenerContainer
Posted by danielmeyer on October 22, 2008
(It’s kind of like King Kong vs. Godzilla, only more peaceful)
According to the Javadoc, these properties on the DefaultMessageListenerContainer “can be modified at runtime, for example through JMX” :
concurrentConsumers
maxConcurrentConsumers
maxMessagesPerTask
idleTaskExecutionLimit
Armed with this and my handy Spring manual, I added the following to my beans file:
<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false"> <property name="beans"> <map> <entry key="bean:name=listenerContainer1" value-ref="listenerContainer" /> </map> </property> </bean>
(In this beans file I already had a DefaultMessageListenerContainer bean with an id of listenerContainer.)
Now when I fired up my JBoss JMX Management, a new bean category appears:
I can click on that link and see several properties that I can change on the DefaultMessageListenerContainer bean, including ConcurrentConsumers, which is currently 1. If I change that to 2 and press the Apply Changes button though, I get a stack trace in JBoss:
12:47:17,978 ERROR [[HtmlAdaptor]] Servlet.service() for servlet HtmlAdaptor threw exception java.lang.ClassNotFoundException: org.springframework.jms.support.destination.DestinationResolver
So we’ll have to figure out what that’s about.

Tristan said
I’ve run into this same issue, did you ever find a resolution?
danielmeyer said
Tristan, I think this is as far as I got – my responsibilities went in a different direction and I never came back to this issue to find a resolution.
Tristan said
Fair enough… If I find it I will write back. Thanks
Tristan said
For the record this is due to JBoss isolation. I documented my findings here :
http://jeemusings.blogspot.com/2009/10/exposing-springs-defaultmessagelistener.html
but you could also look into working with the JBoss classLoader.
Thanks again
danielmeyer said
Nice write-up. Thanks for the link!
-Daniel-