problem with stop method in org.jboss.mq.SpyConnection
berkgypsy Sep 12, 2005 3:12 PMIt seems like the stop() method on the SpyConnection class in JBoss4.0.1 may not be working properly, unless I am doing something wrong. I have message consumer classes that implement MessageListener and register themselves with a QueueReceiver, like so:
Properties props = getJndiContextProperties(); context = new InitialContext(props); this.queueConn = getQueueConnection( context ); log.info("queueConn created: " + queueConn.toString()); this.queueSession = this.queueConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); this.queue = (Queue) context.lookup(getJndiQueueName()); this.queueReceiver = queueSession.createReceiver(queue); this.queueReceiver.setMessageListener(this); this.queueConn.start();
I also have a method on the message consumer class that is accessible from the jmx console whose body looks like this:
/** * Stop the QueueConnection * @jmx.managed-operation * description="stop the JMS queue connection for this message consumer" */ public void stopJMSConnection() { try{ if(queueConn != null) { log.info("stopping JMS Connection on " + this.getQueueName()); log.info("queueConn instance of: " + queueConn.getClass().getName()); queueConn.stop(); if(queueConn instanceof org.jboss.mq.SpyConnection) log.info("modestop: " + ((org.jboss.mq.SpyConnection) queueConn).modeStop); log.info("stop returned, connection: " + queueConn.toString()); } }catch(Exception e) { log.error("Error stopping JMS Connection: " + e); } }
If I execute the stopJMSConnection method from the jmx-console and then send a message to the queue, the MessageListener still processes it, even though the QueueConnection is in a stopped state:
log snippet:
...
12:01:30,249 INFO [jmx.MessageConsumer 219] queueConn created: Connection@23883177[token=ConnectionToken:null/82177ec4472b323eccc23111dbe2752f rcvstate=STOPPED]
...
12:01:30,374 INFO [jmx.MessageConsumer 280] started JMS Connection on AbstractMessageConsumer for queue archiveQ2 queueConn: Connection@23883177[token=ConnectionToken:ID:7/82177ec4472b323eccc23111dbe2752f rcvstate=STARTED]
...
12:01:31,327 INFO [server.Server 432] JBoss (MX MicroKernel) [4.0.1 (build: CVSTag=JBoss_4_0_1 date=200412230944)] Started in 31s:515ms
...
12:01:48,109 INFO [jmx.MessageConsumer 308] stopping JMS Connection on archiveQ2
12:01:48,109 INFO [jmx.MessageConsumer 309] queueConn instance of: org.jboss.mq.SpyConnection
12:01:48,109 INFO [jmx.MessageConsumer 312] modestop: true
12:01:48,109 INFO [jmx.MessageConsumer 313] stop returned, connection: Connection@23883177[token=ConnectionToken:ID:7/82177ec4472b323eccc23111dbe2752f rcvstate=STOPPED]
...
12:01:53,937 INFO [jmx.QueueManager 583] route participantId 3fdefefb185baa4a9bf09fbbfc38b2bb to queueNumber 2
12:01:53,937 INFO [jmx.MessageConsumer 76] received message, connection Connection@23883177[token=ConnectionToken:ID:7/82177ec4472b323eccc23111dbe2752f rcvstate=STOPPED]
...
Any ideas?
Thx