1 Reply Latest reply on Feb 8, 2007 9:03 AM by joy_wind

    Error when close Consumer

    joy_wind

      I hava a message consumer created like this

      ... ...
      consumer = session.createConsumer(destination);
      consumer.setMessageListener(this);
      ... ...

      the code run successful on startup(as a spring bean).but when close at server shutdown using code:
      ... ...
      consumer.close();
      ... ...

      there raise an Exception:
      2007-02-08 10:56:21,197 ERROR [postRegist.JmsListener] Exception when close JMS consumer.
      javax.jms.JMSException: The subscription had not been previously registered
       at org.jboss.mq.server.ClientConsumer.removeSubscription(ClientConsumer.java:248)
       at org.jboss.mq.server.JMSDestinationManager.unsubscribe(JMSDestinationManager.java:548)
       at org.jboss.mq.server.JMSServerInterceptorSupport.unsubscribe(JMSServerInterceptorSupport.j
      ... ...


      According to the log , the server has successfully startup,all queue been inited and my jms listener been created successfully too. the above Exception raised only at the server shutdown.

      What is the problem ?

      Regards

        • 1. Re: Error when close Consumer
          joy_wind

          I have figured out the reason.Simply speaking ,the reason is when the consomer closing,the queue it depended has be stopped.

          to work around it,simply add a "depends" entry in my mbean define descriptor(the jboss-service.xml),making the jms consumer mbean depend on the queue. then at server shutdown these mbean will be stopped in a right order. great!