Non-Durable Subscriptions

Non-durable subscriptions are the lightweight, session-scoped cousin of durable IBM MQ pub/sub. They exist while the subscribing application maintains its connection (or for administrative definitions explicitly marked DURSUB(NO)), and they disappear when that session ends—taking with them the queue manager’s obligation to deliver future publications to that registration. That is ideal when you only care about live data: a trading blotter showing current prices, a monitoring tile updating every second, or a browser session listening for notifications. It is wrong when payroll must process every HR event published over the weekend. Beginners sometimes enable non-durable JMS subscribers by default and wonder why Monday’s batch found no messages. This tutorial contrasts DURSUB(NO) with YES, explains dynamic subscription APIs, covers message loss semantics precisely, documents when non-durable plus non-persistent is appropriate, and gives operations checks to find accidental non-durable use in production.

Lifecycle of a Non-Durable Subscription

Application starts, registers interest in retail/price/# with DURSUB(NO) or equivalent API flag. Publications match and copy to DEST while connected. Application stops or crashes—TCP and MQDISC tear down the session. Queue manager removes the non-durable subscription record. New publications no longer create copies for that registration. Another application instance must create a new subscription; there is no backlog unless you also used a durable sub on a different DEST by mistake.

Non-durable versus durable at a glance
AspectNon-durableDurable
After disconnectSubscription removed (typical)Subscription kept
Missed while offlineLost for that subQueued on DEST
Repository ADMIN subRare in prodCommon pattern
Resource useLower long-termDEST may grow
Use caseLive-only consumersGuaranteed catch-up

MQSC and Administrative Non-Durable

DEFINE SUB('SUB.LIVE.TICKER') DURSUB(NO) TOPICSTR('market/price/#') DEST('LIVE.TICKER.Q') SUBTYPE(ADMIN) is valid for a permanently defined registration that is still non-durable in the IBM sense of subscription durability flags—read IBM docs carefully because SUBTYPE(ADMIN) permanence differs from DURSUB semantics. Most teams use ADMIN with DURSUB(YES) for server consumers and reserve NO for deliberate ephemeral patterns. Mislabeling a production audit sub as DURSUB(NO) is a severity-1 configuration defect.

shell
1
2
3
DEFINE SUB('SUB.LIVE.ONLY') TOPICSTR('telemetry/cpu/#') + DEST('TELEMETRY.LIVE.Q') DURSUB(NO) SUBTYPE(ADMIN) * Consumer must stay connected; stop amqsget — publish — no buildup after disconnect

JMS Non-Durable Subscriber

Session.createConsumer(topic) without durable subscriber APIs creates non-durable interest. Every microservice replica may create its own non-durable sub at startup—fine for competing consumers on one DEST if designed, wasteful if each replica should share one durable backlog. Standardize patterns in your enterprise coding guidelines: durable for commands and audit; non-durable for metrics streams.

Combining With Non-Persistent Publish

Non-durable plus non-persistent publish is the fastest, least reliable path—messages may vanish on restart even while connected. Use only for discardable telemetry. Any compliance tag on the data disqualifies this combination without explicit risk acceptance.

Explainer: Walkie-Talkie Channel

Non-durable is like a walkie-talkie channel while you hold the button—you only hear what is said when you are listening. Hang up and you miss everything until you tune in again with a new session.

Detecting Accidental Non-Durable in Production

  1. DISPLAY SUB(*) and inspect DURSUB column.
  2. Review JMS connection factory durableClientID settings.
  3. Correlate consumer outages with missing event counts in downstream DB.
  4. Search code for createConsumer vs createDurableSubscriber.

Explain Like I'm Five: Non-Durable Subscriptions

You only hear the teacher when you are in the classroom. If you go home, nobody saves the announcements for you—you have to be there to hear them.

Practice Exercises

Exercise 1

Pick durable or non-durable: fraud alert engine, live CPU chart, monthly statement batch.

Exercise 2

Consumer disconnects 10 minutes—explain message fate for each durability choice.

Exercise 3

Write a code review checklist item for JMS pub/sub durability.

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. Non-durable sub when app disconnects:

  • Usually removed
  • Always kept forever
  • Becomes channel
  • Moves to DLQ

2. Best for live ticker UI:

  • Non-durable
  • Durable with 1M depth
  • XMITQ
  • Cluster sender

3. DURSUB(NO) in MQSC means:

  • Non-durable definition
  • SSL required
  • Retain all
  • Cluster only

4. Publications while sub inactive:

  • Not delivered to that sub
  • Queued on topic
  • Sent to DLQ always
  • Duplicated to all QMs
Published
Read time15 min
AuthorMainframeMaster
Verified: IBM MQ 9.3 documentation