Queue manager QM2 example for IBM i
The following object definitions allow applications connected to queue manager QM2 to retrieve request messages from a local queue called PAYROLL, and to put replies to these request messages to a queue called PAYROLL.REPLY on queue manager QM1.
You do not need to provide a remote queue definition to enable the replies to be returned to QM1. The message descriptor of the message retrieved from local queue PAYROLL contains both the reply-to queue and the reply-to queue manager names. Therefore, as long as QM2 can resolve the reply-to queue manager name to that of a transmission queue on queue manager QM2, the reply message can be sent. In this example, the reply-to queue manager name is QM1 and so queue manager QM2 requires a transmission queue of the same name.
All the object definitions have been provided with the TEXT attribute and are the minimum required to make the example work. The attributes that are not supplied take the default values for queue manager QM2.
Run the following commands on queue manager QM2:
- Local queue definition
- The CRTMQMQ command with the following attributes:
QNAME PAYROLL QTYPE *LCL TEXT 'Local queue for QM1 payroll details' PUTENBL *YES GETENBL *YES This queue is defined as PUT(ENABLED) and GET(ENABLED) for the same reason as the reply-to queue definition on queue manager QM1.
- Transmission queue definition
- The CRTMQMQ command with the following attributes:
QNAME QM1 QTYPE *LCL TEXT 'Transmission queue to QM1' USAGE *TMQ PUTENBL *YES GETENBL *YES TRGENBL *YES TRGTYPE *FIRST INITQNAME SYSTEM.CHANNEL.INITQ TRIGDATA QM2.TO.QM1 When the first message is put on this transmission queue, a trigger message is sent to the initiation queue, SYSTEM.CHANNEL.INITQ. The channel initiator gets the message from the initiation queue and starts the channel identified in the trigger data.
- Sender channel definition
- The CRTMQMCHL command with the following attributes:
CHLNAME QM2.TO.QM1 CHLTYPE *SDR TRPTYPE *TCP TEXT 'Sender channel to QM1' TMQNAME QM1 CONNAME '192.0.2.0(1411)'
- Receiver channel definition
- The CRTMQMCHL command with the following attributes:
CHLNAME QM1.TO.QM2 CHLTYPE *RCVR TRPTYPE *TCP TEXT 'Receiver channel from QM1'
Parent topic: What the example for IBM i shows