org.activemq.advisories
Class ConsumerAdvisor

java.lang.Object
  extended byorg.activemq.advisories.ConsumerAdvisor
All Implemented Interfaces:
javax.jms.MessageListener

public class ConsumerAdvisor
extends java.lang.Object
implements javax.jms.MessageListener

A helper class for listening for MessageConsumer advisories

Version:
$Revision: 1.1.1.1 $

Constructor Summary
ConsumerAdvisor(javax.jms.Connection connection, javax.jms.Destination destination)
          Construct a ConsumerAdvisor
 
Method Summary
 java.util.Set activeConsumers(javax.jms.Destination destination)
          return a set of active ConsumerInfo's for a particular destination
 void addListener(ConsumerAdvisoryEventListener l)
          Add a listener
 boolean isActive(javax.jms.Destination destination)
          returns true if there is an active subscriber for the destination
 void onMessage(javax.jms.Message msg)
          OnMessage() implementation
 void removeListener(ConsumerAdvisoryEventListener l)
          Remove a listener
 void start()
          start listening for advisories
 void stop()
          stop listening for advisories
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsumerAdvisor

public ConsumerAdvisor(javax.jms.Connection connection,
                       javax.jms.Destination destination)
                throws javax.jms.JMSException
Construct a ConsumerAdvisor

Parameters:
connection -
destination - the destination to listen for Consumer events
Throws:
javax.jms.JMSException
Method Detail

start

public void start()
           throws javax.jms.JMSException
start listening for advisories

Throws:
javax.jms.JMSException

stop

public void stop()
          throws javax.jms.JMSException
stop listening for advisories

Throws:
javax.jms.JMSException

addListener

public void addListener(ConsumerAdvisoryEventListener l)
Add a listener

Parameters:
l -

removeListener

public void removeListener(ConsumerAdvisoryEventListener l)
Remove a listener

Parameters:
l -

isActive

public boolean isActive(javax.jms.Destination destination)
returns true if there is an active subscriber for the destination

Parameters:
destination -
Returns:
true if a subscriber for the destination

activeConsumers

public java.util.Set activeConsumers(javax.jms.Destination destination)
return a set of active ConsumerInfo's for a particular destination

Parameters:
destination -
Returns:
the set of currently active ConsumerInfo objects

onMessage

public void onMessage(javax.jms.Message msg)
OnMessage() implementation

Specified by:
onMessage in interface javax.jms.MessageListener
Parameters:
msg -


Copyright © 2004-2005 Protique, Ltd.. All Rights Reserved.