Publication routing is the journey from MQPUT on a topic string to one or more puts on subscriber destination queues. The publisher does not address each consumer by name—the queue manager pub/sub engine resolves the topic in the tree, evaluates every active subscription, and routes copies according to local rules, wildcard matching, retained publication options, and cluster topology. Understanding routing separates “publish returned OK” from “consumer received data”—orphan publishes with zero matching subs succeed without error. Cluster routing adds hops over CLUSSDR and CLUSRCVR with PUBSCOPE and propagated SUBSCOPE in the decision. This tutorial walks the local routing path step by step, cluster forwarding, fan-out arithmetic, interaction with persistent and non-persistent messages, proxy and stream edge cases at overview level, failure modes, DISPLAY diagnostics, and performance planning when routing multiplies puts across data centers.
No match means successful publish with zero deliveries—log publish string and DISPLAY SUB TOPICSTR when debugging “lost” events.
| Input | Role in routing | If wrong |
|---|---|---|
| Publish topic string | Leaf path published | Typo—no match |
| Subscription TOPICSTR | Pattern to match | Wrong + or # |
| SUB state | Must be active | Deleted or expired sub |
| DEST availability | Target for put | Full or missing queue |
| PUB/SUB authority | Allow put to topic and DEST | 2035 on publish or route |
Engine compares published string segments to subscription patterns. Publish retail/uk/order/created does not match retail/+/created because two levels exist between retail and created where + allows one. Test patterns in lab with amqspub and a known subscriber queue. Hierarchy design and routing success are the same problem—see topic hierarchies tutorial.
12345DEFINE SUB('ORDERS.UK') TOPICSTR('retail/uk/order/#') DESTQL('UK.ORDERS.SUB') DEFINE SUB('ORDERS.ANY.SHIPPED') TOPICSTR('retail/+/shipped') DESTQL('SHIP.SUB') * Publish retail/uk/order/created -> UK.ORDERS.SUB only * Publish retail/us/shipped -> SHIP.SUB only DISPLAY QLOCAL('UK.ORDERS.SUB') CURDEPTH
When publisher and subscriber live on different queue managers, routing consults cluster repository knowledge: clustered topic PUBSCOPE, subscription SUBSCOPE propagation, and channel availability. Local engine on publishing QM may hand off to cluster transport; receiving QM puts to local DEST. Asymmetric cluster ACL or stopped CLUSSDR mimics routing failure. Pair with subscription propagation and clustered topics tutorials.
One publish to prod/announcement/company with fifty ALL-scoped subscriptions across ten queue managers can produce fifty puts and significant channel bytes. High-rate publishers on broad topics need subscription governance—avoid accidental duplicate subs during testing. Monitor publish rate × match count = delivery rate.
When retain is set on a publish, new matching subscriptions may receive the last retained message on registration per IBM rules—routing includes retain lookup in addition to live publish stream. Do not confuse with durable subscription backlog from offline consumers.
Publication routing is the sorting room: one incoming package (publish) is photocopied for every person on the matching mailing list (subscriptions) and placed in their mailbox (DEST). No list match means the package is discarded after accept—still “posted OK.”
When someone shouts a dinosaur fact, the teacher makes a copy for every kid who raised their hand for dinosaur news and puts it in their cubby. Routing is making and delivering those copies.
Given two subs, predict which DEST receives publish retail/de/ship/done.
Calculate puts if publish matches 7 subs on 3 queue managers.
Write debug command list for publish OK, empty DEST.
1. Publication routing delivers to:
2. Ten matching subs means:
3. Cluster routing uses:
4. Publish OK, no messages—check: