Announcement Announcement Module
No announcement yet.
DefaultMessageListenerContainer does not release JMS connection on stop. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • DefaultMessageListenerContainer does not release JMS connection on stop.

    I'm trying to write some integration tests that make use of JMS Queue.

    As part of the setUp() call I want to drain the Queue of existing messages.

    We have multiple Queues to drain and the test may only use some of the available queues. So I want to drain the queues first, stop the containers and only start the ones needed in the test code.

    However I can't just use stop() as, DefaultMessageListenerContainer doesn't appear to release the connections to the server on calls to stop().

    I've tried combinations of
    * stop
    * shutdown
    * destroy

    and then followed with:
    * initialize

    And they give me the error:
    11/04/2008 11:28:09 ERROR org.springframework.jms.listener.DefaultMessageLis tenerContainer [server1ListenerContainer-2] - Setup of JMS message listener invoker failed - trying to recover
    weblogic.jms.common.IllegalStateException: [JMSClientExceptions:055082]The connection is closed
    at weblogic.jms.client.JMSConnection.getFrontEndDispa tcher(
    at weblogic.jms.client.JMSConnection.setupJMSSession(
    at weblogic.jms.client.JMSConnection.createSessionInt ernal(
    at weblogic.jms.client.JMSConnection.createSession(JM
    at weblogic.jms.client.WLConnectionImpl.createSession (
    at Session(
    at org.springframework.jms.listener.DefaultMessageLis tenerContainer.access$1000(DefaultMessageListenerC
    at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.initRes ourcesIfNecessary(DefaultMessageListenerContainer. java:883)
    at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.invokeL istener(
    at org.springframework.jms.listener.DefaultMessageLis tenerContainer$

    The methods I think I should use are all protected:
    * refreshConnectionUntilSuccessful()
    * refreshDestination()

    Am I missing something?
    Should I just define a DMLC for setUp() use only?
    Suggestions welcome.


  • #2
    For now I have created a drain specific beans for the message listener and DMLC.