Topic hierarchies are the deliberate design of how slash-separated levels are arranged before the first application publishes. IBM MQ does not mandate finance/payment/posted versus payment/finance/posted—the queue manager accepts any valid string—but enterprises that skip hierarchy planning drown in duplicate events, broken wildcards, and audit failures when nobody can list all subjects in a domain. Hierarchy design ties together topic trees, administrative topic objects, cluster parents, subscription patterns, and security prefixes. This tutorial gives beginners a practical framework: environment layer, domain layer, entity layer, event layer, optional region and version layers; naming rules; how hierarchy interacts with + and #; versioning and migration; anti-patterns; governance artifacts; and worked examples you can paste into a topic catalog workshop.
| Level | Example segment | Purpose |
|---|---|---|
| 1 – Environment | prod, test, dr | Isolate non-production traffic |
| 2 – Domain | finance, retail, logistics | Business capability ownership |
| 3 – Entity | payment, order, shipment | Aggregate subscriptions with +/# |
| 4 – Event | posted, cancelled, shipped | Fine-grained application interest |
| 5 – Region or version (optional) | eu, v2 | Regulatory partition or schema generation |
Full example: prod/finance/payment/eu/posted. A subscription prod/finance/payment/# receives all payment events in production finance for all regions; prod/finance/+/eu/posted narrows to EU posted events only. Writing the hierarchy document before MQSC prevents developers inventing prod/finance/posted and prod/payments/finance/posted as competing paths.
When you add a region level, every subscription using + must gain a position or switch to #. Migration from prod/retail/order/created to prod/retail/uk/order/created breaks prod/retail/+/created because two variable levels now exist where + allowed one. Plan hierarchy depth before shipping first consumers. Document which integration partners may use # at entity level versus exact leaf only—broad # at prod/retail/# can double message volume overnight when a new high-frequency sensor topic appears under retail.
1234567* Catalog-aligned definitions DEFINE TOPIC('PROD.RETAIL.ADMIN') TOPSTR('prod/retail') TOPTYPE(CLUS) + CLUSTER('CORP') DESCR('Production retail branch') DEFINE TOPIC('PROD.RETAIL.ORDER.CREATED') + TOPSTR('prod/retail/order/created') TOPTYPE(LOCAL) DEFINE SUB('ANALYTICS.RETAIL.ORDERS') TOPICSTR('prod/retail/order/#') + DESTQL('ANALYTICS.RETAIL.SUB') DESTQMGR('QM1')
Schema changes—new JSON fields, renamed events—should add a version segment rather than reusing the same string with incompatible payload. prod/finance/payment/v1/posted and prod/finance/payment/v2/posted run in parallel; publishers cut over; subscribers migrate subscriptions; ALIAS topic objects can point legacy names to v2 during transition. Retire v1 only when DISPLAY SUB shows zero consumers and monitoring confirms zero publish rate for seven business days (your policy may differ).
Maintain a topic catalog spreadsheet or internal portal: level definitions, owning team, sample payload, retention policy, allowed publishers, cluster name, PUBSCOPE, example subscription. Link each row to DEFINE TOPIC object name. Change control requires architecture review when adding domain roots or new environment prefixes. Quarterly DISPLAY TOPIC(*) diff against catalog catches drift.
Hierarchy is country / city / street / building / apartment. Everyone uses the same order so mail sorts correctly. Random address formats mean mail arrives late or to the wrong apartment—even if each line “looks fine” alone.
Topic hierarchy is agreeing how to write addresses so everyone puts country, then city, then street in the same order. If one friend writes street-first and another country-last, the mail room gets confused.
Design hierarchy for healthcare claims with environment, domain, entity, event, region.
Given migration adding region level, rewrite subscription prod/logistics/+/delivered.
Write five naming rules for your organization topic catalog.
1. A good enterprise hierarchy usually includes:
2. prod/finance/payment/v2/completed has how many levels?
3. Version in hierarchy helps when:
4. test/ and prod/ prefixes primarily prevent: