For users of Apache ActiveMQ 4.0 or later please see Advisory Message. In previous 3.x versions the following is supported:-

The destination string constants are available in ActiveMQDestination

ActiveMQDestination.CONSUMER_ADVISORY_PREFIX
ActiveMQDestination.PRODUCER_ADVISORY_PREFIX
ActiveMQDestination.CONNECTION_ADVISORY_PREFIX
ActiveMQDestination.TEMP_DESTINATION_ADVISORY_PREFIX

A subscription to each of the destination returns an ObjectMessage with a specific object: ConsumerInfo, ProducerInfo,ConnectionInfo, TempDestinationAdvisoryEvent.

For example:

...
    String advisoryName = ActiveMQDestination.PRODUCER_ADVISORY_PREFIX + destination.getPhysicalName();
    Destination advisoryDestination = ActiveMQDestination.createDestination(destination.getDestinationType(), advisoryName);
    MessageConsumer consumer = session.createConsumer(advisoryDestination);
    consumer.setMessageListener(this);
....
public void onMessage(Message msg){
    if (msg instanceof ObjectMessage){
        try {
            ProducerInfo info = (ProducerInfo)((ObjectMessage)msg).getObject();
        } catch (JMSException e) {
            log.error("Failed to process message: " + msg);
        }
    }
}
© 2004-2011 The Apache Software Foundation.
Apache ActiveMQ, ActiveMQ, Apache, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram