In messaging systems, message routing is done on the basis of a concept called Topics: First, we need to have topics created in the message broker (WSO2 MB). A JMS client can then be configured to publish messages to this topic and other JMS clients can be configured as subscribers of this topic. When the publisher sends a message to the topic, it will be dispatched to all the JMS clients that are subscribed to that topic as depicted in the following diagram:
For example, consider that we have a topic called 'SportsNews' created in the message broker. We can now have users (JMS clients) publishing messages related to sports news to this topic. Users (JMS clients) that are interested in sports news can subscribe to this topic and receive the messages that are published.
Here are some of the key qualities of message routing using WSO2 MB:
- Messages published to WSO2 MB are stored in the DB, which means that all messages published to WSO2 MB are inherently persistent.
- When a message is published to a topic, a copy of the topic is dispatched to all the subscribers.
- A subscription to a topic can be non-durable or durable depending on how the subscriber client implements the subscription. If the subscription is non-durable, the subscriber client will only receive the messages that are published while the subscriber client is active. If the subscription is durable, the subscriber client has the ability to recover the messages that were published to the topic while the subscriber was inactive.
- Topics in WSO2 MB are secured by role-based permissions. This means that a JMS client can publish messages or consume messages from a topic, only using the credentials of an authorized user.
The capability of managing topics and subscriptions in WSO2 Message Broker is provided by the following features in the WSO2 feature repository:
Name: WSO2 Carbon - Event Feature
Name: WSO2 Carbon - Feature - Andes
This feature can be removed or added to a different distribution if it is not already bundled as described in Working with Features.