activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From darrickc <>
Subject Can someone point me to an example of using a ConsumerEventSource
Date Fri, 06 Feb 2009 22:49:00 GMT

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:
Sent from the ActiveMQ - User mailing list archive at

View raw message