Topic objects are how administrators give structure to IBM MQ publish/subscribe. Business events use human-readable topic strings—inventory/item/updated, healthcare/claim/approved—but operations need catalog names, descriptions, cluster routing, and authority boundaries. DEFINE TOPIC creates that catalog entry: it links a short object name to a TOPICSTR, sets whether the branch is local or clustered, and documents who may publish or subscribe under that part of the tree. This tutorial focuses on the administrative object, not the general pub/sub pattern (covered in publish/subscribe messaging). You will learn the topic tree, TOPTYPE values, alias and cluster topics, relationship to subscriptions, wildcards, retention flags at topic level, and MQSC you can run in a lab queue manager.
Topic strings are usually slash-separated paths. The tree groups related events: retail/order/created, retail/order/shipped, retail/customer/updated. Hierarchy matters for wildcard subscriptions: finance/+/completed matches finance/payment/completed and finance/refund/completed but not finance/payment/eu/completed unless you use #. Planning the tree early prevents chaotic flat names like EVENT001. Many enterprises publish a topic catalog PDF alongside MQSC: allowed prefixes, schema versions, and test versus production branches (test/retail/... vs prod/retail/...).
| TOPTYPE | Typical use |
|---|---|
| LOCAL | |
| CLUS | |
| ALIAS |
Developers can MQPUT publishing to the string retail/order/created directly. Operations prefer DEFINE TOPIC('RETAIL.ORDER.CREATED') TOPICSTR('retail/order/created') so DISPLAY TOPIC shows the mapping, DESCR documents the owner team, and ALTER TOPIC adjusts routing without recompiling applications. JMS and IBM MQ classes may use either style depending on API calls. Consistency rules: either always resolve through objects in production, or always use strings in dev-only labs—not a mix without documentation.
An administrative topic object can define defaults for child strings under its branch—authority inheritance, proxy subscription behavior, and cluster routing flags vary by MQ version; consult IBM MQ documentation for attributes such as MDUREXP, PUBSCOPE, and SUBSCOPE on your release. Cluster topics (TOPTYPE CLUS) publish metadata to full and partial repositories so a subscriber on QM_B receives publications from QM_A when the subscription and topic tree align. Misconfigured cluster topics are a common reason publications never leave the publishing queue manager.
Subscriptions (covered in the subscriptions tutorial) attach wildcard patterns to destination queues. At the topic object level, you document which branches allow # and +. Publishing to retail/# is invalid—you publish to concrete strings; subscribers use wildcards. Retained publications (RETAIN flag on publish) let late subscribers receive the last message for a topic when supported—useful for status topics like plant/line1/status.
Topic authority controls who may publish or subscribe under a subtree. On distributed MQ, AUTHREC and topic profiles apply; on z/OS, RACF may protect topics. Lock down prod/finance/* so only approved service accounts publish. Test environments mirror structure with relaxed authority. DISPLAY TPSTATUS and subscription displays help audits.
12345678910DEFINE TOPIC('RETAIL.ORDER') REPLACE + TOPICSTR('retail/order') TOPTYPE(LOCAL) + DESCR('Retail order events branch') DEFINE TOPIC('RETAIL.ORDER.CREATED') REPLACE + TOPICSTR('retail/order/created') TOPTYPE(LOCAL) DEFINE TOPIC('RETAIL.ORDER.SHIPPED') REPLACE + TOPICSTR('retail/order/shipped') TOPTYPE(LOCAL) DISPLAY TOPIC('RETAIL.ORDER*') * Publish with MQ API using string retail/order/created * Or open topic object RETAIL.ORDER.CREATED per your client API
A radio station name is the topic—Sports, Music, News. The station does not keep copies of every listener's tape recorder; listeners tune in at home (their own queue). The topic object is the official station listing in the TV guide that says which frequency matches which show name.
Sketch a topic tree for a bank with branches for payments, loans, and alerts. Include at least six leaf strings.
When would you choose TOPTYPE ALIAS instead of LOCAL? Give a rename scenario.
A publisher sends to retail/order/created but no subscriber receives. List five checks across topic string, subscription, and authority.
1. DEFINE TOPIC primarily creates:
2. TOPICSTR on a topic object holds:
3. Wildcard + in a subscription matches:
4. TOPTYPE(CLUS) is used for: