Advisory messages for new producers are not send

Solution Verified - Updated -

Environment

  • Fuse Message Broker 5.x
  • Fuse MQ Enterprise 7.x
  • JBoss Fuse 6.0
  • Apache ActiveMQ 5.x

Issue

Sometimes a new producer that connects to the broker does not trigger an advisory message to destination ActiveMQ.Advisory.Producer.Queue.XXX.

Resolution

Although anonymous producers don't trigger avisory messages, these producers are still registered in JMX under the context org.apache.activemq/Producer/Dynamic.

Root Cause

Anonymous producers currently don't trigger an advisory message.
An anonymous producer is a producer that does not specify a JMS destination when being started.
E.g. it could be created as follows:

ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "admin", url); 
Connection connection = connectionFactory.createConnection();
connection.start();
Destination destination = session.createQueue(queueName);
MessageProducer producer = session.createProducer(null);
producer.send(destination, message);

Notice the call to session.createProducer() does not pass in a destination name.
This is totally valid as such producer can send to multiple destinations, rather than creating a producer per destination.
There is some more information on http://docs.oracle.com/cd/E13222_01/wls/docs90/jms/implement.html.

Such anonymous producer will not trigger an advisory message but will be registered in JMX under org.apache.activemq/Producer/Dynamic.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments