Dynamic queues let applications create queue names at runtime without a separate DEFINE QLOCAL for every possible name. The queue manager copies attributes from a model queue (QMODEL) and instantiates a real local queue when the program MQOPENs with the right dynamic naming pattern. Request-reply is the classic pattern: each client gets a private reply queue name, puts a request with ReplyToQ set, and reads the answer only on that queue. This overview explains how dynamic creation works, how model queues fit in, naming rules, temporary versus permanent lifecycles, security, monitoring clutter, and links to deeper pages on each dynamic type.
Administrators DEFINE QMODEL('REPLY.MODEL') with DEFTYPE(TEMPDYN) or PERMDYN plus defaults like MAXDEPTH, DEFPSIST, and SHARE. The model is not where messages land in steady state—opening it with dynamic intent creates child queues. Multiple models support different policies: short-lived reply queues versus longer-lived partner workspaces.
| Aspect | Static QLOCAL | Dynamic queue |
|---|---|---|
| Created by | DEFINE QLOCAL admin | MQOPEN on model |
| Name known | Before deploy | At runtime |
| Lifecycle | Until DELETE | Temp or perm rules |
| Typical use | Work queues | Reply queues |
Client opens model, gets dynamic name AMQ.8723.12345678.REPLY, puts request to SERVER.REQUEST with ReplyToQ set to that name, CorrelId or MsgId linking response. Server processes, puts reply to ReplyToQ. Client gets on private queue—no cross-talk between clients. When client closes with temp dynamic rules, queue vanishes—cleanup automatic.
Letting the queue manager generate names (forms using *) avoids collisions. Prefix AMQ.* is common for generated names. Applications supplying their own names must coordinate uniqueness—two programs opening the same dynamic name share one queue, which may be intended or catastrophic. JMS temporary queues use similar concepts under vendor prefixes.
Restrict which IDs may open the model with create authority. Wildcard authority on dynamic names is sensitive—attackers could create many queues exhausting resources. MAXDEPTH on the model caps each dynamic instance. Monitor object counts during load tests.
DISPLAY QLOCAL(*) during peak may list hundreds of AMQ.* queues—normal for request-reply. Alerts on object count or repository size help. Stale permanent dynamic queues from buggy apps that never MQCO_DELETE require housekeeping scripts.
123456789DEFINE QMODEL('REPLY.MODEL') REPLACE + DEFTYPE(TEMPDYN) MAXDEPTH(1000) DEFPSIST(NO) + DESCR('Template for temp reply queues') DEFINE QLOCAL('SERVER.REQUEST') REPLACE MAXDEPTH(100000) * Application code (pseudocode): * open model -> dynamic reply name * put to SERVER.REQUEST with ReplyToQ = dynamic name * get from dynamic reply * close dynamic with options -> queue deleted if TEMPDYN
Instead of building a hundred mailboxes in advance, you ask the post office to make one disposable box with your ticket number when you arrive. When you leave, they recycle the box (temporary) or keep it until you say throw it away (permanent).
Draw request-reply message flow with model queue, dynamic reply, and server queue.
Why should only trusted apps open REPLY.MODEL?
When would PERMDYN beat TEMPDYN?
1. Dynamic queues are created when:
2. QMODEL objects:
3. Request-reply often uses dynamic queues for:
4. DEFTYPE on model sets: