[jboss-user] [JBoss Messaging] - JBM2 Beta4 with JBAS5.1 - setListener( null )

simon_temple do-not-reply at jboss.com
Wed Aug 19 04:43:13 EDT 2009


Using the JMS API.  If I attempt to clear the currently registered listener on a QueueReceiver then I get an IllegalStateException when I try to receive on it:

javax.jms.IllegalStateException: Cannot call receive(...) - a MessageHandler is set
  | 	at org.jboss.messaging.core.client.impl.ClientConsumerImpl.receive(ClientConsumerImpl.java:161)
  | 	at org.jboss.messaging.jms.client.JBossMessageConsumer.getMessage(JBossMessageConsumer.java:213)
  | 	at org.jboss.messaging.jms.client.JBossMessageConsumer.receiveNoWait(JBossMessageConsumer.java:146)

I have a simple test case which looks this:

			queueReceiver.setMessageListener( listener );
  | 
  | 			queueConnection.start(  );
  | 			thread.wait( 30000 );
  | 
  | 			queueReceiver.setMessageListener( null );
  | 			queueReceiver.receiveNoWait(  );
  | 

How can I clear the message listener attribute from a QueueReceiver once it's been set? 

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

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



More information about the jboss-user mailing list