Configure a publish/subscribe cluster

Define a topic on a queue manager. To make the topic a cluster topic, set the CLUSTER property. To choose the routing to use for publications and subscriptions for this topic, set the CLROUTE property.


Before you begin

Some cluster configurations cannot accommodate the overheads of direct routed publish/subscribe. Before we use this configuration, explore the considerations and options detailed in Designing publish/subscribe clusters.

For changes to a cluster to be propagated throughout the cluster, at least one full repository must always be available. Ensure that your repositories are available before starting this task.

See also Routing for publish/subscribe clusters: Notes on behavior.

Scenario:

  • The INVENTORY cluster has been set up as described in Add a queue manager to a cluster. It contains three queue managers; LONDON and NEWYORK both hold full repositories, PARIS holds a partial repository.


About this task

When you define a topic on a queue manager in a cluster, you need to specify whether the topic is a cluster topic, and (if so) the routing within the cluster for publications and subscriptions for this topic. To make the topic a cluster topic, you configure the CLUSTER property on the TOPIC object with the name of the cluster. By defining a cluster topic on a queue manager in the cluster, you make the topic available to the whole cluster. To choose the message routing to use within the cluster, you set the CLROUTE property on the TOPIC object to one of the following values:

  • DIRECT
  • TOPICHOST

By default, topic routing is DIRECT. This was the only option prior to IBM MQ Version 8.0. When you configure a direct routed clustered topic on a queue manager, all queue managers in the cluster become aware of all other queue managers in the cluster. When performing publish and subscribe operations, each queue manager can connect direct to any other queue manager in the cluster. See Direct routed publish/subscribe clusters.

From IBM MQ Version 8.0, we can instead configure topic routing as TOPICHOST. When we use topic host routing, all queue managers in the cluster become aware of the cluster queue managers that host the routed topic definition (that is, the queue managers on which we have defined the topic object). When performing publish and subscribe operations, queue managers in the cluster connect only to these topic host queue managers, and not directly to each other. The topic host queue managers are responsible for routing publications from queue managers on which publications are published to queue managers with matching subscriptions. See Topic host routed publish/subscribe clusters.

Note: After a topic object has been clustered (through setting the CLUSTER property) we cannot change the value of the CLROUTE property. The object must be un-clustered (CLUSTER set to ' ') before we can change the value. Un-clustering a topic converts the topic definition to a local topic, which results in a period during which publications are not delivered to subscriptions on remote queue managers; this should be considered when performing this change. See The effect of defining a non-cluster topic with the same name as a cluster topic from another queue manager. If you try to change the value of the CLROUTE property while it is clustered, the system generates an MQRCCF_CLROUTE_NOT_ALTERABLE exception.


Procedure

  1. Choose a queue manager to host your topic.

    Any cluster queue manager can host a topic. Choose one of the three queue managers ( LONDON, NEWYORK or PARIS) and configure the properties of the TOPIC object. If you plan to use direct routing, it makes no operational difference which queue manager you choose. If you plan to use topic host routing, the chosen queue manager has additional responsibilities for routing publications. Therefore, for topic host routing, choose a queue manager that is hosted on one of your more powerful systems and has good network connectivity.

  2. Define a topic on a queue manager. To make the topic a cluster topic, include the cluster name when you define the topic, and set the routing to use for publications and subscriptions for this topic. For example, to create a direct routing cluster topic on the LONDON queue manager, create the topic as follows:
    DEFINE TOPIC(INVENTORY) TOPICSTR('/INVENTORY') CLUSTER(INVENTORY) CLROUTE(DIRECT)
    
    By defining a cluster topic on a queue manager in the cluster, you make the topic available to the whole cluster.

    For more information about using CLROUTE, see DEFINE TOPIC (CLROUTE) and Routing for publish/subscribe clusters: Notes on behavior.


Results

The cluster is ready to receive publications and subscriptions for the topic.


What to do next

If we have configured a topic host routed publish/subscribe cluster, you will probably want to add a second topic host for this topic. See Add extra topic hosts to a topic host routed cluster.

If we have several separate publish/subscribe clusters, for example because your organization is geographically dispersed, you might want to propagate some cluster topics into all the clusters. We can do this by connecting the clusters in a hierarchy. See Combining the topic spaces of multiple clusters. We can also control which publications flow from one cluster to another. See Combining and isolating topic spaces in multiple clusters.