Queues

Queues are the mailboxes of IBM MQ—where messages live until someone collects them or a channel forwards them. Every beginner story starts with MQPUT and MQGET on a queue name; understanding queue types and attributes separates lab success from production reliability. This overview covers local, remote, alias, and model queues, special-purpose queues such as transmission and dead-letter queues, essential attributes like MAXDEPTH and DEFPSIST, GET and PUT authority, and how queues fit into clusters. Deeper tutorials in this series drill into each property; here you build the mental model.

Local Queues (QLOCAL)

A local queue stores messages on the queue manager where it is defined. CURDEPTH increases on put and decreases on get. Applications and channels both use local queues—business work queues, transmission queues, initiation queues, and the dead-letter queue are all QLOCAL underneath. Capacity, persistence, triggering, and sharing options apply here.

Remote Queues (QREMOTE)

A remote queue is a definition, not a separate mailbox on disk. It names RNAME (remote queue name), RQMNAME (remote queue manager), and XMITQ (transmission queue on this manager). When an app puts to the remote queue name, the queue manager stores the message on the XMITQ and a sender channel delivers it. Operators change routing by ALTER QREMOTE without touching application code if names stay stable.

Alias Queues (QALIAS)

Alias queues point to another queue name—local, remote, or another alias. Use them for environment-specific indirection (PAYMENTS.IN alias to PAYMENTS.IN.PROD) or to switch destinations during migration. DISPLAY QALIAS shows TARGQ and TARGQMGR. Misconfigured targets cause puts to wrong queues silently if authority allows.

Model Queues (QMODEL)

Model queues define defaults for temporary dynamic queues created when an application requests a dynamic queue name in MQOPEN. Request/reply patterns use model queues so each request gets a private reply queue that expires when closed. Permanent dynamic queues are a related advanced topic.

Queue types at a glance
TypeStores messages?Typical use
QLOCALYes
QREMOTENo (routes)
QALIASNo (indirection)
QMODELTemplate only
XMITQ (QLOCAL)Yes, pending forward

Explainer: Essential Attributes

MAXDEPTH caps message count—when full, producers block or fail. MAXMSGL caps bytes per message. DEFPSIST sets default persistence. GET and PUT control whether consumers and producers may access the queue. SHARE allows multiple applications to get concurrently with appropriate options. TRIGGER and related attributes enable the trigger monitor. BOQNAME and BOTHRESH route poison messages to backout queues. Compare attribute combinations: a high-throughput telemetry queue might use DEFPSIST(NO) and large MAXDEPTH; a payment queue uses DEFPSIST(YES) and moderate depth with alerting.

Special-Purpose Queues

  • Transmission queue—feeds sender channels.
  • Dead-letter queue (DEADQ on QMGR)—receives undeliverable messages.
  • Initiation queue—internal trigger messages.
  • Cluster queue—local queue published to cluster workload management.

Tutorial: Define a Work Queue and Alias

shell
1
2
3
4
5
6
7
DEFINE QLOCAL('ORDERS.IN') REPLACE + MAXDEPTH(100000) MAXMSGL(1048576) DEFPSIST(YES) + DESCR('Inbound orders') GET(ENABLED) PUT(ENABLED) DEFINE QALIAS('ORDERS') TARGET('ORDERS.IN') REPLACE DEFINE QREMOTE('ORDERS.TO.HUB') REPLACE + RNAME('ORDERS.IN') RQMNAME('QM_HUB') XMITQ('QM_HUB.XMIT') DISPLAY QLOCAL('ORDERS.IN') CURDEPTH MAXDEPTH DEFPSIST

Explain Like I'm Five: Queues

A queue is a mailbox with a name. You drop letters in (put) and someone takes them out (get). A remote queue is a sign that says “this mail goes to another city’s post office.” An alias is a second label on the same mailbox.

Practice Exercises

Exercise 1

App puts to QREMOTE ORDERS.TO.HUB. Name objects touched on local QM before channel sends.

Exercise 2

MAXDEPTH 1000, CURDEPTH 1000. What happens on next MQPUT?

Exercise 3

When use QALIAS instead of renaming QLOCAL?

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. Messages are physically stored on:

  • QLOCAL (and XMITQ as local)
  • QREMOTE only
  • CHANNEL objects
  • LISTENER objects

2. QALIAS is used to:

  • Provide another name for a queue
  • Encrypt messages
  • Replace the log
  • Start listeners

3. CURDEPTH is:

  • Current message count on the queue
  • Maximum message size
  • Channel port
  • User ID

4. QMODEL supports:

  • Temporary dynamic queues
  • Only permanent queues
  • Only topics
  • Only SSL
Published
Read time15 min
AuthorMainframeMaster
Verified: IBM MQ 9.3 documentation