How JMS destinations relate to service integration destinations
Most WebSphere Application Server applications use the JMS APIs to access the services provided by the service integration bus. JMS defines JMS destinations, which are the Java objects to which JMS applications send messages and from which JMS applications receive messages. The attributes of a JMS destination include the address of the destination that the messaging provider uses. For the service integration messaging provider, this address is a service integration destination name (a queue name or topic space name) and a bus name. In this way, a JMS destination can identify a service integration bus destination.
Typically, a JMS application obtains a JMS destination from JNDI lookup of the destination JNDI name. However, a JMS application can also obtain a JMS destination in other ways, for example, from the JMSReplyTo property of a JMS message.
JMS destinations - queues and topics
A JMS destination can be one of the following destination types:
- JMS queue destination
- Used for point-to-point messaging, in which producing applications (producers) send messages to a queue. The messaging provider stores just one copy of each message until a consuming application (consumer) receives the message. If there are several consumers, only one consumer receives a copy of the message; if there are no consumers, the message is queued.
In service integration, a JMS queue destination object has a queue name property and a bus name property (it also has other properties).
- JMS topic destination
- Used for publish/subscribe messaging, in which producing applications (publishers) send messages (publications) to a topic. The messaging provider delivers a copy of each publication to each consuming application (subscriber). If there are no subscribers, service integration discards the publication.
Another difference from point-to-point messaging is that subscribers can consume messages from multiple similar topics by including wildcards in a topic name (publishers cannot include wildcards in a topic name).
In service integration, a JMS topic destination object has a topic name, a topic space name, and a bus name property (it also has other properties).
JMS destinations - relationship with service integration destinations
In service integration, a JMS destination identifies a service integration destination. Its queue name or topic space name property is the name of the service integration destination. Its bus name property is the name of the service integration bus containing the destination.
We can omit the bus name property when you define the JMS destination. If we do then the JMS destination identifies the service integration destination in the local bus; that is, whichever bus the JMS application connects to. This can be convenient where there is only one service integration bus or where all buses contain a destination with the same name.
Service integration includes the following destination types:
- Service integration queue destination
- A queue destination represents a message queue and is used for point-to-point messaging. A service integration queue destination is localized in a particular bus member (application server or cluster of application servers). When a producer sends a message to the queue destination, the service integration bus delivers the message to a messaging engine in that bus member. The messaging engine then delivers the message to a consumer. If necessary, the messaging engine queues the message until a consumer is ready to receive it.
Typically, a JMS queue destination identifies a service integration queue destination; that is, its bus name property matches the local bus name and its queue name property matches the name of a service integration queue destination in the local bus.
- Service integration topic space destination
- A topic space destination represents a set of "publish and subscribe" topics and is used for publish/subscribe messaging. The topic for a specific message (publication) is a property of the message. A service integration topic space destination is not localized in a particular bus member. Service integration maintains a list of subscriptions in the topic space and matches each publication against that list. When a new publication matches one or more subscriptions in the topic space, service integration delivers a copy of the publication to each subscriber. If necessary, service integration can queue the publication message until the subscriber is ready to receive it. If the new publication does not match any subscription, service integration discards the publication.
Typically, a JMS topic destination identifies a service integration topic space destination; that is, its bus name property matches the local bus name and its topic space name property matches the name of a service integration topic space destination in the local bus. When a JMS application sends a message to the JMS topic destination, service integration sets the destination topic property of the message to the topic name property of the JMS topic destination and then sends the message to the service integration topic space destination.
- Service integration foreign destination
- A foreign destination represents a destination defined in another bus (a foreign bus). We can use a foreign destination for point-to-point messaging. You use a foreign destination if we need to override security settings, or messaging defaults, for an individual destination on a foreign bus. The foreign bus can be another service integration bus or a WebSphere MQ network (that is, one or more interconnected WebSphere MQ queue managers or queue-sharing groups). When a producer sends a message to a foreign destination, service integration delivers the message to the foreign bus. The foreign bus is then responsible for queueing the message, as appropriate, based on its definition of the destination.
A JMS destination can identify a service integration foreign destination; that is, its bus name and queue or topic space name properties can match the foreign bus name and queue or topic space name of the foreign destination. However, this is not always necessary. If there is no service integration foreign destination with a matching foreign bus name and a matching destination (queue or topic space) name, service integration sends the message to the specified foreign bus anyway.
Related concepts
JMS queue resources and service integration