I think you want to listen to new producers and consumers at a specific destination (a specific lineup or topic). Is it correct?
You can instantiate ConsumerEventSource and ProducerEventSource and register your own listeners by calling their setConsumerListener and setProducerListener, respectively.
So:
Connection conn = yourconnection;
If you look at the code for ConsumerEventSource or ProducerEventSource, you will see that these are simple objects that use the AdvisorySupport methods to listen on a special advisory topic, the purpose of which is to transmit news about manufacturers and consumers. You can learn more by reading the source code for these classes.
Your use of the “connection” is potentially a problem; in an ActiveMQ zone (which is a subset of the JMS land), a “Connection” is a lower level entity that is not associated with a specific destination. A particular client creates a “session” from the connection — still not specific to the destination — and then creates the target QueueSender, QueueReceiver, TopicPublisher, or TopicSubscriber. When they are created or when the sessions ripening them die, these are the events that you want to hear about, and find out if you use the code above.
source share