JMS destinations (queues and topics)

A JMS destination is an object (a JMS queue or a JMS topic) that represents the target of messages that the client produces and the source of messages that the client consumes. In point-to-point messaging, destinations represent queues; in publish/subscribe messaging, destinations represent topics.

The JMS client can use a single destination object to put messages on and to get messages from, or the JMS client can use separate destination objects. The same destination object can be used for both IBM® MQ and Real-time messaging providers so, unlike with connection factories, you do not need to create separate destination objects for different messaging providers. Real-time transport is not available in IBM MQ 8.0. If you are using IBM MQ 8.0 you can define Real-time transport, but it fails when an attempt is made to create a connection.

In the figure, the destination called Destination 1 is stored in the Destinations folder of the initial context called File System Initial Context.

A screen capture of a destination in the Destinations folder.

When you create a destination object, you must specify whether the destination is a JMS queue (in the point-to-point messaging domain) or a JMS topic (in the publish/subscribe messaging domain); you cannot change the domain after the destination has been created. You must also configure the destination with the name of the queue or topic that the destination represents. An advantage of using JMS is that you can change the name of the queue or topic that the JMS client uses by changing the value of a property in the destination definition and you do not update the JMS client itself.

For more information, see Using IBM MQ classes for JMS and Publish/subscribe messaging.