Direct routing in publish/subscribe clusters

Publications from any publishing queue manager are routed direct to any other queue manager in the cluster with a matching subscription.

For an introduction to how messages are routed between queue managers in publish/subscribe hierarchies and clusters, see Distributed publish/subscribe networks.

A direct routed publish/subscribe cluster behaves as follows:
  • All queue managers automatically know of all other queue managers.
  • All queue managers with subscriptions to clustered topics create channels to all other queue managers in the cluster and inform them of their subscriptions.
  • Messages published by an application are routed from the queue manager that it is connected to, direct to each queue manager where a matching subscription exists.

The following diagram shows a queue manager cluster that is not currently used for publish/subscribe or point-to-point activities. Note that every queue manager in the cluster connects only to and from the full repository queue managers.

Figure 1. A queue manager cluster
A cluster is shown containing a number of queue managers. Two of the queue managers are full repositories, and know everything about the activities of the cluster. All the other queue managers in the cluster are connected by channels to the full repositories.

For publications to flow between queue managers in a direct routed cluster, you cluster a branch of the topic tree as described in Configuring a publish/subscribe cluster, and specify direct routing (the default).

In a direct routed publish/subscribe cluster, you define the topic object on any queue manager in the cluster. When you do this, knowledge of the object, and knowledge of all other queue managers in the cluster, is automatically pushed to all queue managers in the cluster by the full repository queue managers. This happens before any queue manager references the topic:

Figure 2. A direct routed publish/subscribe cluster
A cluster is shown containing a number of queue managers, including two full repositories. All other queue managers in the cluster are connected by channels to the full repositories. A topic has been defined on a queue manager. Consequently, all queue managers know about the topic, and about all other queue managers in the cluster.

When a subscription is created, the queue manager that hosts the subscription establishes a channel to every queue manager in the cluster, and sends details of the subscription. This distributed subscription knowledge is represented by a proxy subscription on each queue manager. When a publication is produced on any queue manager in the cluster that matches that proxy subscription's topic string, a cluster channel is established from the publisher queue manager to each queue manager hosting a subscription, and the message is sent to each of them.

Figure 3. A direct routed publish/subscribe cluster with a publisher and a subscriber to a clustered topic
A cluster is shown containing a number of queue managers, including two full repositories. All other queue managers in the cluster are connected by channels to the full repositories. A topic has been defined on a queue manager. Consequently, all queue managers know about the topic, and about all other queue managers in the cluster. One of the partial repository queue managers hosts a subscription to the topic. Consequently, that queue manager is connected by channels to all other queue managers in the cluster. A publication is received on another queue manager, and sent direct to the queue manager that hosts the subscription.

The direct routing of publications to subscription hosting queue managers simplifies configuration and minimizes the latency in delivering publications to subscriptions.

However, depending on the location of subscriptions and publishers, your cluster can quickly become fully interconnected, with every queue manager having a direct connection to every other queue manager. This might or might not be acceptable in your environment. Similarly, if the set of topic strings being subscribed to is changing frequently, the overhead of propagating that information between all queue managers can also become significant. All queue managers in a direct routed publish/subscribe cluster must be able to cope with these overheads.

Figure 4. A direct routed publish/subscribe cluster that is fully interconnected
A cluster is shown containing a number of queue managers. Because the cluster is hosting a significant number of topics and subscriptions, every queue manager has become directly connected to every other queue manager.

Summary and additional considerations

A direct routed publish/subscribe cluster needs little manual intervention to create or administer, and provides direct routing between publishers and subscribers. For certain configurations it is usually the most appropriate topology, notably clusters with few queue managers, or where high queue manager connectivity is acceptable and subscriptions are changing infrequently. However it also imposes certain constraints upon your system:
  • The load on each queue manager is proportional to the total number of queue managers in the cluster. Therefore, in larger clusters, individual queue managers and the system as a whole can experience performance issues.
  • By default, all clustered topic strings subscribed to are propagated throughout the cluster, and publications are propagated only to remote queue managers that have a subscription to the associated topic. Therefore rapid changes to the set of subscriptions can become a limiting factor. You can change this default behavior, and instead have all publications propagated to all queue managers, which removes the need for proxy subscriptions. This reduces the subscription knowledge traffic, but is likely to increase the publication traffic and the number of channels each queue manager establishes. See Subscription performance in publish/subscribe networks.
    Note: A similar restriction also applies to hierarchies.
  • Because of the interconnected nature of publish/subscribe queue managers, it takes time for proxy subscriptions to propagate around all nodes in the network. Remote publications do not necessarily start being subscribed to immediately, so early publications might not be sent following a subscription to a new topic string. You can remove the problems caused by the subscription delay by having all publications propagated to all queue managers, which removes the need for proxy subscriptions. See Subscription performance in publish/subscribe networks.
    Note: This restriction also applies to hierarchies.
Before you use direct routing, explore the alternative approaches detailed in Topic host routing in publish/subscribe clusters, and Routing in publish/subscribe hierarchies.