Publish/subscribe messaging and topic spaces
We can use publish/subscribe messaging to publish one message to many subscribers. A producing application publishes a message on a given subject area or topic. The topic for a specific message (publication) is a property of the message. Consumer applications that have subscribed to the topic each receive a copy of the message. A topic space is a hierarchy of publish/subscribe topics. These topics have publication points automatically defined on each messaging engine in their associated service integration bus.
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.
A topic space has a set of default publish/subscribe permissions for all topics in the hierarchy. An administrator can configure individual publish/subscribe topics with specific permissions and mediations. Publish/subscribe topics inherit such configurations from higher publish/subscribe topics in the topic space hierarchy and the topic space itself.
Publish/subscribe topics with the same name can exist in multiple topic spaces, but there can be only one topic space with a given name in the bus. For example, consider a publish/subscribe topic hierarchy split into the following topic spaces:
- library
- Topics for document management.
- sales
- Topics for marketing and sales tracking.
The publish/subscribe topic "volumes" can appear in the topic hierarchy in both topic spaces, and can have different meanings in each.
A producing application can attach to any messaging engine on the bus. Messages are stored in the message store for the messaging engine to which the producer is attached. As a result, a topic space can have messages stored in a number of message stores at various (producing) messaging engines in the bus. Messages for a publish/subscribe topic are published to a publication point and automatically forwarded to all other publication points for which there are subscribers on that topic.
Figure 1. Publish/subscribe messaging
The default messaging provider supports durable subscriptions to publish/subscribe topics. These enable a subscriber to receive a copy of all messages published to a topic, even messages published during periods of time when the subscriber is not connected to the server. For a given JMS connection factory or activation specification, all publish/subscribe messages to be delivered to durable subscriptions are stored on the publication point of the messaging engine named by the durable subscription home property. Therefore if that messaging engine is unavailable, subscribers cannot retrieve messages. These undelivered messages are preserved and sent to the durable subscriptions after the messaging engine restarts.
Subtopics
- Workload sharing with publish/subscribe messaging
In publish/subscribe messaging, the messaging system sends one copy of every published message to each matching subscription. Subscribers, that is, applications that consume publish/subscribe messages, consume those messages from an individual subscription. To balance workload across multiple instances of an application, for example when an application runs in a server cluster, all instances of the application must use the same subscription.
- The consequences of changing durable subscriptions
When an application connects to an existing durable subscription, but specifies parameters that differ from those that were used to create the existing subscription, the subscription is deleted then recreated with the new parameters. A durable subscription can be changed in this way only when it has no active consumers.
- Topic names and use of wildcard characters in topic expressions
Wildcard characters can be used in topic expressions to retrieve topics provided by the default messaging provider and service integration technologies.
Related concepts
JMS topic resources and service integration
Related tasks
Create a topic space for publish/subscribe messaging
Topic names and use of wildcard characters in topic expressions
Related information:
Topic space [Settings]