Defining cluster topics
Publishing and subscribing applications can publish to any topic string, with no need for an administered topic object to be defined. However, if the publishing applications are connected to a cluster queue manager that is different to the queue managers where subscriptions are created, an administered topic object must be defined and added to the cluster. To make a topic a cluster topic, you specify the name of the cluster in its definition.
Before you begin
This task assumes that we have completed the steps in Configure the third queue manager.
The administered topic object identifies the point in the topic tree that is clustered through its topic string. Publishing and subscribing applications can use any topic string at or below that point, and their messages are automatically transmitted between queue managers.
When you define a cluster topic, you also choose its routing model. For more information about publication routing in clusters, see Designing publish/subscribe clusters.
For this scenario we use the default routing of DIRECT. This means that messages are sent direct from a publishing queue manager to the subscribing queue managers.
Procedure
-
Define the cluster topic SCORES on PS3.
To make the topic a cluster topic, specify the name of the cluster, and set the cluster routing ( CLROUTE ) to use for publications and subscriptions for this topic.
-
Launch the MQSC interface.
In the command line, enter the following command:
runmqsc PS3
-
Define the cluster topic SCORES.
Enter the following MQSC command:
DEFINE TOPIC(SCORES) TOPICSTR('/Sport/Scores') CLUSTER(DEMO) CLROUTE(DIRECT)
- Enter end to exit the MQSC interface for PS3.
-
Launch the MQSC interface.
In the command line, enter the following command:
-
Verify the topic definition on PS1.
-
Launch the MQSC interface for PS1.
In the command line, enter the following command:
runmqsc PS1
-
Display the cluster state for cluster topic SCORES.
Enter the following MQSC command:
DISPLAY TCLUSTER(SCORES) CLSTATE
-
Launch the MQSC interface for PS1.
In the command line, enter the following command:
What to do next
For a more detailed exploration of this task, see Configure a publish/subscribe cluster.
You are now ready to verify the solution. See Testing the publish/subscribe cluster.