A publisher in IBM MQ is any program that announces an event to the enterprise by putting a message on a topic. The order service publishing retail/order/placed, the mainframe payment module emitting finance/payment/settled, or a microservice using JMS publish—all are publishers. They do not address subscriber queues directly; they trust the queue manager to fan out copies. That decoupling is the architectural win and the security challenge: PUB authority must be tight, payload schemas versioned, and publish rates monitored because one careless loop can flood every subscription matching #. This tutorial covers MQI open/put on topics, message descriptor fields beginners must set, persistence and correlation, JMS and REST alternatives, syncpoint behavior, retain for state topics, error codes when PUB is missing, and performance habits that keep pub/sub healthy in mixed COBOL and Java estates.
Publishers own correct topic strings, serialization format (JSON, XML, fixed COBOL), persistence choice aligned with business durability, and correlation IDs for request/reply over topics when used. They do not own subscriber queue depth—yet publish storms can overwhelm slow subscribers indirectly when DEST queues fill and back-pressure policies trigger. Include message size discipline: large payloads multiply by subscriber count. Consider reference data patterns (publish an ID, consumers fetch detail) for huge objects.
| Concept | Effect | When to use |
|---|---|---|
| Persistent publish | Copies survive restart if DEST queues persistent | Financial or audit events |
| Non-persistent publish | Lower overhead; loss if subs offline | Telemetry with tolerance for gaps |
| Correlation ID | Links related messages | Request/reply over topics |
| Retain (if supported) | Last message kept for new subs | Config/status topics only |
| Syncpoint | Commit/rollback with DB2 or CICS | Transactional outbox patterns |
Typical sequence: MQCONNX, MQOPEN topic for output (or MQPUT1 with resolved string per API style), fill MQMD (format, persistence, correlation), MQPUT, MQCMIT or rollback, MQCLOSE, MQDISC. Topic object name in OPEN reduces string typos. PMO options control context and retain flags per IBM definitions for your release.
123456789/* Illustrative MQI publish — error handling omitted */ MQCONNX(QMgrName, &cno, &Hcon, &CompCode, &Reason); MQOPEN(Hcon, &od, MQOO_OUTPUT, &Hobj, &CompCode, &Reason); /* od is descriptor for topic name or string */ memcpy(md.MsgId, MQMI_NONE, sizeof(md.MsgId)); md.Persistence = MQPER_PERSISTENT; memcpy(md.Format, MQFMT_STRING, (size_t)MQ_FORMAT_LENGTH); MQPUT(Hcon, Hobj, &md, &pmo, buflen, buffer, &CompCode, &Reason); MQCMIT(Hcon, &CompCode, &Reason);
JMS publishers use session.createProducer(topic) and producer.send(message). Connection factory must point at SVRCONN with correct MCAUSER and PUB rights. .NET XMS and Java share similar models. Node and Python clients wrap MQI—same authority rules. REST POST to messaging API is a publisher without local MQI—still needs PUB authority for the authenticated user.
Missing PUB yields not authorized on put (2035 on distributed). Fix setmqaut -t topic -n 'branch/#' -p ServiceId +pub. Publishers should not run as mqm or admin MCAUSER in production. Map SVRCONN to dedicated producer IDs. CHLAUTH and TLS protect the connection; PUB protects the topic tree.
At-least-once middleware and application retries can publish duplicates. Subscribers should dedupe using business keys in payload or message ID when exactly-once semantics are required. Publishers can set MsgId or group identifiers; document whether duplicate MsgId is possible from your retry logic.
The publisher is the town crier shouting news in the square (topic). The crier does not walk to every house; listeners who signed up get copies delivered to their doors (subscriber queues).
A publisher is the kid who presses the button on the school intercom to announce one message to everyone listening for that kind of news.
Write setmqaut for producer APP1 to PUB on inventory/stock/# only.
Estimate disk when persistent 2 KB publish matches six durable subscriptions.
List MD fields you set for JSON order event versus COBOL copybook event.
1. Publisher needs authority:
2. Fan-out is performed by:
3. MQPUT to topic sets routing via:
4. Persistent publish with 5 subs: