Thursday, 21 January 2016

Transferring a message from one queue manager to another one

In this scenario, we will create two queue managers QMGR1 AND QMGR2 in two different systems. The objective is to transfer a message from QMGR1 to QMGR2. We first need to create a local queue(LQ) in QMGR2 then we need to create a transmission queue (QMGR2) in QMGR1. We also need to create remote queue(RQ) on QMGR1 which points to the LQ of QMGR2. We need to create a sender channel in QMGR1 and receiver channel in QMGR2. When we put the message in remote queue (RQ) of QMGR1 it will appear in the local queue (LQ) of QMGR2.

The following steps were tested on windows system and the same would work in other platforms too.

  1. Create and start the queue manager in system 1
    1. CRTMQM QMGR1 <-- to create a queue manager
    2. STRMQM QMGR1 <-- to start a queue manager
  2. Create transmission queue and listener in system 1
    1. RUNMQSC QMGR1 <-- opens a command window to issue commands specific to the queue manager
    2. DEFINE QLOCAL(TQ) USAGE(XMITQ) <-- to create a transmission queue
  3. Create another queue manager in system 2 using the following commands
    1. CRTMQM QMGR2 <-- to create a queue manager
    2. STRMQM QMGR2 <-- to start a queue manager
  4. Create a local queue and receiver channel queue in system 2
    1. RUNMQSC QMGR2 <-- Use this command to issue MQSC commands to a queue manager  
    2. DEFINE QLOCAL(LQ) <-- to create the local queue
    3. DEFINE LISTENER (LISTENER_NAME) TRPTYPE (TCP) PORT(PORT NUMBER) <-- to create a listener
    4. DEFINE CHANNEL(QMGR1_TO_QMGR2) CHLTYPE(RCVR) TRPTYPE(TCP) <-- to create the receiver channel
  5. Create the remote queue and sender channel in system1
    1. RUNMQSC QMGR1 <--Use this command to issue MQSC commands to the queue manage
    2. DEFINE QREMOTE(RQ) RNAME(LQ) RMQNAME(QMGR2) XMITQ(TQ) <-- to create remote queue
    3. DEFINECHANNEL (QMGR1_TO_QMGR2) CHLTYPE(SDR) CONNAME('QMGR2_HOSTNAME(PORT NUMBER)')  XMITQ(TQ)<----to create sender channel
  6. NOTE:THE SENDER CHANNEL NAME AND RECIVER CHANNEL NAME SHOULD BE SAME. Now come out of RUNMQSC command by typing the command "END"
  7. Put the message in remote queue of system 1
    1. AMQSPUT RQ QMGR1 <-- after this type your message and double click enter
  8. Get the message from the local queue in system 2
    1. AMQSGET LQ QMGR2 <-- you can see the message which is transmitted in the system 1

No comments :

Post a Comment