In messaging systems, message routing is done on the basis of a concept called Topics: First, we need to have topics created in the EI Message Broker runtime. 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.
Topics in the message broker facilitate the Publish-Subscribe Channel enterprise integration pattern.
Topics and sub topics can be easily added using the management console of the EI Message Broker runtime. The topics and sub topics you create will be arranged into a tree navigator, which you can expand and collapse to get an overview of the parent-child topic structure. You can also view details of a particular topic or sub topic by simply clicking on the topic in the tree navigator. Once a topic is addd to the broker, users will be able to publish information to the topic and subscribe to the information published.
Following the instructions given below.
The possibility to work with Topics in EI Message Broker are strictly secured by role-based permissions. Therefore, a user needs to be linked to a role with the relevant permissions in order to start managing Topics for the broker. See the following links for details on how roles and permissions are set up for a user.
- Find out about the permissions required for working with Topics.
- Creating roles and assigning permissions.
- Creating users and assigning roles.
Adding topics from the management console
To create a new topic using the management console:
- Log in to the management console.
- In the Main tab, click Topics -> Add. The Add Topic screen will open.
Enter a name for the topic in the Topic field.
Note the following for the Topic name:
- Topic name can starts with any of the following: * , alphanumeric characters (a-z, A-Z or 0-9). These can be used any number of times delimited by dots.
- Topic name can end with the following: * , alphanumeric characters, hash (#).
- The “/” symbol (TENANT_SEPARATOR) can only be used to separate the tenant domain from the topic name when creating topics/subscribing to topics from external clients.
- The colon (":") can be used in Topic names if the
allowStrictNameValidation>property is set to
broker.xmlfile (stored in the
<EI_HOME>/wso2/broker/conffolder). This is only applicable for the AMQP transport.
- Now you need to grant permissions for users in your system to publish and subscribe to the topic you are creating. You will be granting these permissions to users based on the user's role. As shown below, all the user roles in your tenant domain will be listed. You can select the relevant check box against each role:
- If the Subscribe check box is selected, the users linked to the role has permission to subscribe to the topic.
- If the Publish check box is selected, the users linked to the role has permission to publish information to the topic.
The user that creates a topic in the system is by default granted permission to Subscribe and Publish to that particular topic. This is handled in the system by automatically creating an internal role and assigning it to the user creating the topic.
- Click Add Topic to create the topic.
- If the topic is added successfully, a message appears. Click OK to view the topic browser where the newly added topic is listed in a tree view:
- Click on the topic to view all the operations available. See the section on viewing topic details for more information.
Adding sub topics from the management console
You can add a sub topic under an existing topic as shown below.
- Go to the Topic Browser to select the parent topic.
- Click the topic to see the details.
- Click Add Subtopic to create the sub topic. The information that should be provided when adding a subtopic is the same as when adding a main topic.
- Once a sub topic is added, it will be displayed in the Topic Browser window under the main topic.
Viewing topic details
Once you have added your topics to the Topics Browser, you can view detailed information about the topic as shown below.
- Click on the topic in the Topic Browser. The Details option will be listed.
Click Details to open the Topic Details screen:
The following table shows descriptions of the parameters on this page:
Detail Description Permission Details Permissions related to the topic can be viewed here. Permissions can be changed by clearing or selecting the provided check boxes and clicking Update Permissions once done. JMS Subscription Details All the durable and non-durable JMS subscriptions are listed here. Publish Publish a sample XML message to a topic. When there is a subscription for the topic, the event sink URL receives the XML message specified here. Click the Publish button after placing the XML message in the provided space.
Deleting a topic
To delete a topic, the subscription count for that topic and its children should be zero. If not, an error message appears specifying that there are subscriptions for the topic or its children.