+

Search Tips | Advanced Search

Intercepting publications and distributed publish/subscribe

Follow a simple pattern when you deploy intercepting subscribers or Publish exits to a distributed publish/subscribe topology. Deploy intercepting subscribers on the same queue managers as publishers, and Publish exits on the same queue managers as final subscribers.

Figure 1 shows two queue managers connected in a publish subscribe cluster. A publisher creates a publication to a cluster topic at publication level 9. The numbered arrows show the sequence of steps taken by the publication as it flows to subscribers to the cluster topic. The publication is intercepted by the subscriber with Sublevel 9 and republished with Publevel 8. It is intercepted again by a subscriber at Sublevel 8. The subscriber republishes at Publevel 7. The proxy subscriber provided by the queue manager forwards the publication to queue manager B, where a Publish exit has been deployed in addition to a final subscriber. The publication is processed by the Publish exit before it is finally received by the final subscriber at Sublevel 1. The intercepting subscribers and the publish exit are shown with broken outlines.
Figure 1. Interception and Publish exit in a cluster

The objective of the simple pattern is for every subscriber receiving a publication to receive the identical publication. The publication goes through the same sequence of transformations regardless of where the subscriber is connected. You probably want to avoid having the sequence of transformations varying, depending on where the publishers or final subscribers are connected. An reasonable exception would be to tailor the publication finally delivered to each individual subscriber. Use the Publish exit to do customize the publication based on the queue to which the publication is finally delivered.

We must consider carefully where to deploy intercepting subscribers and Publish exits in a distributed publish/subscribe topology. The straightforward pattern deploys intercepting subscribers to the same queue manager as the publishers, and Publish exits to the same queue managers as the final subscribers.


Anti-pattern

Figure 2 shows how matters can go awry, if we do not follow a simple pattern. To complicate the deployment, a final subscriber is added to queue manager A and two additional intercepting subscribers are added to queue manager B.

The publication is forwarded to queue manager B at PubLevel 7, where it is intercepted by a subscriber at SubLevel 5 before being consumed by the final subscriber at SubLevel 1. The Publish exit intercepts the publication before it is passed to both the intercepting consumer and the final consumer at queue manager B. The publication reaches the final subscriber on queue manager A without being processed by the Publish exit.

In a publish/subscribe topology, proxy subscribers subscribe at SubLevel 1, and pass on the PubLevel set by the last intercepting subscriber. In Figure 2, the result is that the publication is not intercepted by the subscriber using SubLevel 9 at queue manager B.

Figure 2. Complex deployment of intercepting subscribers
Parent topic: Intercepting publications

Last updated: 2020-10-04