It 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: [EMAIL 
PROTECTED]:null/82177ec4472b323eccc23111dbe2752f rcvstate=STOPPED]
...
12:01:30,374 INFO  [jmx.MessageConsumer 280] started JMS Connection on 
AbstractMessageConsumer for queue archiveQ2 queueConn: [EMAIL 
PROTECTED]: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: [EMAIL 
PROTECTED]: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 [EMAIL 
PROTECTED]:ID:7/82177ec4472b323eccc23111dbe2752f rcvstate=STOPPED]
...

Any ideas?

Thx

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3894317#3894317

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3894317


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to