Reply-to Queues

Reply-to queues are how IBM MQ answers the question where should the response go without coupling server code to every client installation. The requester encodes return routing in ReplyToQ and optionally ReplyToQMgr on the message descriptor; the service reads those fields and puts the reply there. Enterprise request/reply, CICS clients talking to Linux services, and Java microservices on the mainframe all use the same mechanism. This page explains static versus dynamic reply queues, model queue definitions, remote reply across queue managers, security and authorization on reply puts, common misconfigurations, timeouts, and how ReplyToQ works with CorrelId and MsgId from the correlation and message ID tutorials.

ReplyToQ and ReplyToQMgr Fields

ReplyToQ is a 48-character queue name (platform rules apply for name length and characters). ReplyToQMgr is a 48-character queue manager name. When the server processes a request on QM_SERVER and ReplyToQ is APP01.REPLY on QM_APP01, the server put must reach QM_APP01—often via a remote queue definition or default reply queue manager handling depending on API and channel setup. When both client and server share one queue manager, ReplyToQMgr is often blank and the reply is local. Always verify PUT authority on the reply queue for the server connection id.

Reply routing patterns
PatternReplyToQReplyToQMgr
Local dynamicSYSTEM.MQ*.generated nameBlank (same QM)
Local staticCLIENT.REPLIESBlank
Remote replyCLIENT.REPLIESQM_CLIENT
InvalidBlank or deleted queueWrong name

Temporary Dynamic Queues

The requester opens a model queue such as REPLY.MODEL with MQOPEN options that create a dynamic queue. MQ returns a name like AMQ85942.REPLY.MODEL. That name becomes ReplyToQ on the request put. Only the creating connection typically reads it until shared—by design private. When the connection closes, the dynamic queue disappears unless retained by options—check your client. Model queues set DEFTYPE(TEMPDYN) or similar and attributes like MAXDEPTH, SHARE, and DEFPSIST that dynamic queues inherit.

Static Shared Reply Queues

Older designs use one queue REPLIES.ALL for many clients. Each request must set CorrelId/MQGET match so clients do not steal each other replies. Prefer dynamic queues or per-application static queues for clarity. Shared queues still appear in legacy CICS regions—document correlation rules strictly.

Server Implementation Checklist

  1. MQGET request; read ReplyToQ and ReplyToQMgr from request MD.
  2. Validate names are non-blank and authorized.
  3. Build reply MD: CorrelId = request MsgId, new MsgId.
  4. MQPUT to named reply queue (open queue or put to resolved name).
  5. Commit under syncpoint if request get was syncpointed.

Remote Reply and Channels

Server on QM_A puts reply to QM_B requires either ReplyToQMgr open on QM_A with channels to QM_B, or putting to a QREMOTE that resolves to the client reply queue. Asymmetric firewalls often block reply path even when requests flow in. Network diagrams must show bidirectional channel or independent reply channels. Test reply puts in lower environments with the same CONNAME and TLS as production.

JMS Temporary Queues

JMSQueueSession.createTemporaryQueue() maps to MQ dynamic reply infrastructure. ReplyToQ in underlying MQMD is set when using JMSReplyTo. Ensure requestor consumes with the same session or saves destination. MQI and JMS mixed flows need a mapping document for operations.

Tutorial: Model Queue MQSC

shell
1
2
3
4
5
6
7
DEFINE QMODEL('REPLY.MODEL') REPLACE + DEFTYPE(TEMPDYN) MAXDEPTH(1000) SHARE + DEFPSIST(NO) * Application: MQOPEN model with options to create dynamic queue * Use returned name as ReplyToQ on request put * Server: PUT reply using ReplyToQ from request MD DISPLAY QLOCAL('REPLY.MODEL') DEFTYPE

Explain Like I'm Five: Reply-to Queue

You hand the teacher a question paper with a sticky note saying put the answer in my locker number 12. The teacher does not guess your locker—you told them where to deliver. ReplyToQ is the locker number; ReplyToQMgr is which school building if your locker is in another building.

Practice Exercises

Exercise 1: Firewall

Requests flow A→B but ReplyToQ is on A. List channel/auth checks for reply puts from B.

Exercise 2: Dynamic vs Static

Compare operational cost of 500 static reply queues vs dynamic from one model.

Exercise 3: Debug

Client times out; reply depth on ReplyToQ is 1. List five causes including CorrelId mismatch.

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. The server puts the reply to:

  • The request queue
  • ReplyToQ from the request MQMD
  • SYSTEM.DEAD.LETTER.QUEUE only
  • Any topic

2. Temporary dynamic queues are created from:

  • A model queue
  • A channel
  • A listener only
  • DEFPSIST only

3. ReplyToQMgr is needed when:

  • Reply queue is on another queue manager
  • Messages are non-persistent only
  • Using only pub/sub
  • Never

4. Shared static reply queue without CorrelId causes:

  • Clients may read wrong replies
  • Higher persistence
  • Automatic DLQ
  • Channel BIND
Published
Read time14 min
AuthorMainframeMaster
Verified: IBM MQ 9.3 documentation