I have an embedded broker in my server process and I'd like to know in my
server process when a client subscribes to a certain topic. Through reading
these forums I've figured out that using a ConsumerEventSource is the way to
go. When I get an event I can figure out how many consumers there are for a
topic like:

public void onConsumerEvent( ConsumerEvent consumerEvt )
{
        numOfConsumers = consumerEvt.getConsumerCount()
}

Here is how I've setup my consumer for ConsumerEvents:


// here topic is something like "Something.status.STOP" 
//but I've also tried "ActiveMQ.Advisory.Consumer.Topic."+topic
destination = session.createTopic(topic);

//Here the connection is the connection in the server that is used to
publish messages on to the consumers.
ConsumerEventSource ces = new ConsumerEventSource(connection, destination);
ConsumerListener listener = new SubscriberListener(topic);
//subscriberListener implements ConsumerListener
ces.setConsumerListener( listener );

Am I missing something here?
-- 
View this message in context: 
http://www.nabble.com/Can-someone-point-me-to-an-example-of-using-a-ConsumerEventSource-tp21882293p21882293.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to