On 09/14/2010 08:46 AM, [email protected] wrote:

I am using Java API to make a listener listening on a queue. How can I
disable this listener? The code I used is:

MessageConsumer consumer = session.createConsumer(queue);
consumer.setMessageListener(listener)

Depending on what you mean by disabling the listener, either:

  consumer.close();//[1]

or:

  consumer.setMessageListener(null);//[2]


[1] http://download.oracle.com/javaee/1.4/api/javax/jms/MessageConsumer.html#close%28%29

[2] http://download.oracle.com/javaee/1.4/api/javax/jms/MessageConsumer.html#setMessageListener%28javax.jms.MessageListener%29 "Setting the message listener to null is the equivalent of unsetting the message listener for the message consumer."

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to