Sun Java System Message Queue 4.2 Release Notes

Multiple Destinations for a Publisher or Subscriber

In Message Queue 4.2, a publisher can now publish messages to multiple topic destinations and a subscriber can consume messages from multiple topic destinations. This capability is achieved by using a topic destination name that includes wildcard characters, representing multiple destinations. Using such symbolic names allows administrators to create additional topic destinations, as needed, consistent with the wildcard naming scheme. Publishers and subscribers automatically publish to and consume from the added destinations. (Wildcard topic subscribers are more common than publishers.)

Note –

This feature does not apply to queue destinations.

The format of the symbolic topic destination name consists of multiple segments, in which wildcard characters (*, **, >) can represent one or more segments of the name. For example, suppose you have a topic destination naming scheme as follows:


where the topic name segments can have the following values:

Message Queue supports the following wildcard characters:

You can therefore indicate multiple topic destinations as follows:

large.*.circle would represent:

**.square would represent all names ending in .square, for example:

small.> would represent all destination names starting with small., for example:

To use this multiple destination feature, you create topic destinations using a naming scheme similar to that described above. Client applications can then create wildcard publishers or wildcard consumers using symbolic destination names. For example:

String DEST_LOOKUP_NAME = "large.*.circle";
Topic t = (Destination) ctx.lookup(DEST_LOOKUP_NAME);
TopicPublisher myPublisher = mySession.createPublisher(t)
String DEST_LOOKUP_NAME = "**.square";
Topic t = (Destination) ctx.lookup(DEST_LOOKUP_NAME);
TopicSubscriber mySubscriber = mySession.createSubscriber(t);
Message m = mySubscriber.receive();

In the first example, the broker will place a copy of the message in any destination that matches the symbolic name large.*.circle. In the second example, a subscriber will be created if there is at least one destination that matches the symbolic name **.square and will receive messages from all destinations that match that symbolic name. If there are no destinations matching the symbolic name, the subscriber will not be created until such a destination exists.

If an administrator creates additional destinations that match a symbolic name, then wildcard publishers created using that symbolic name will subsequently publish to that destination and wildcard subscribers created using that symbolic name will subsequently receive messages from that destination.

In addition, Message Queue administration tools, in addition to reporting the total number of publishers (producers) and subscribers (consumers) for a topic destination, will also report the number of publishers that are wildcard publishers (including their corresponding symbolic destination names) and the number of subscribers that are wildcard subscribers (including their symbolic destination names), if any.