MQ Distributed Queueing setup/Point-TO-Point setup

IBM MQ allows independent and potentially non-concurrent applications on a distributed system to securely communicate with each other, using messages.
It supports 2 tyeps of setup’s . 1 is point to point 2nd is publish- Subscribe messaging .

Point-To-Point Setup/Distributed Queueing Setup

Communication between 2 QMGR’s happened using send and receive data is called point to point setup .This is also called Distributed Queueing.
We can setup Point-To-Point Setup in 2 ways .
1.Standalone setup
2.Cluster Setup

publish–subscribe setup

Publish–subscribe is a messaging pattern where senders of messages, called publishers, do not program the messages to be sent directly to specific receivers, called subscribers, but instead categorize published messages into classes without knowledge of which subscribers, if any, there may be. Similarly, subscribers express interest in one or more classes and only receive messages that are of interest, without knowledge of which publishers, if any, there are.

We will setup Point-To-Point setup with 2 QMGR’s where both side have a application which will send and receive message . Let us say one application will send request message to another application and other application will process the message and return response back to the requested application

Above diagram show required MQ objects to create for message flow on both the ways.

MQ commands for the above setup is show in the below table .

W3.CSS
Obj Type\Name QMGR: QM1 QMGR: QM2
QMGR crtmqm QM1 crtmqm QM2
QMGR strmqm QM1 strmqm QM2
Hostname ec2-18-218-83-33.us-east-2.compute.amazonaws.com ec2-18-218-83-33.us-east-2.compute.amazonaws.com
PORT 1414 1415
CREATE Listener DEFINE LISTENER(QM1.LST) TRPTYPE(TCP) CONTROL(QMGR) PORT(1414) DEFINE LISTENER(QM2.LST) TRPTYPE(TCP) CONTROL(QMGR) PORT(1415)
START Listener START LISTENER(QM1.LST) START LISTENER(QM2.LST)
XMITQ DEFINE QL(QM1.XMITQ) USAGE(XMITQ) DEFINE QL(QM2.XMITQ) USAGE(XMITQ)
Sender Channel DEFINE CHANNEL(TO.QM2) CHLTYPE(SDR) CONNAME(‘ec2-18-218-83-33.us-east-2.compute.amazonaws.com(1415)’) XMITQ(QM1.XMITQ) TRPTYPE(TCP) DEFINE CHANNEL(TO.QM1) CHLTYPE(SDR) CONNAME(‘ec2-18-218-83-33.us-east-2.compute.amazonaws.com(1414)’) XMITQ(QM2.XMITQ) TRPTYPE(TCP)
Receiver Channel DEFINE CHANNEL(TO.QM1) CHLTYPE(RCVR) TRPTYPE(TCP) DEFINE CHANNEL(TO.QM2) CHLTYPE(RCVR) TRPTYPE(TCP)
Local Queue DEFINE QL(QM1.QL) DEFINE QL(QM2.QL)
Remote Queue DEFINE QR(QM2.QR) RNAME(QM2.QL) RQMNAME(QM2) XMITQ(QM1.XMITQ) DEFINE QR(QM1.QR) RNAME(QM1.QL) RQMNAME(QM1) XMITQ(QM2.XMITQ)
Start ChanneL START CHL(TO.QM2) START CHL(TO.QM1)
Verify chl status DIS CHS(*) DIS CHS(*)

Note: We are using single server to host both QMGR’s . In the actual or PROD environments each server will host one QMGR .

On QM1

mqm@ip-172-31-14-154 ~]$ crtmqm QM1
IBM MQ queue manager created.
Directory '/var/mqm/qmgrs/QM1' created.
The queue manager is associated with installation 'Installation1'.
Creating or replacing default objects for queue manager 'QM1'.
Default objects statistics : 83 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.
[mqm@ip-172-31-14-154 ~]$ 
[mqm@ip-172-31-14-154 ~]$ strmqm QM1
The system resource RLIMIT_NOFILE is set at an unusually low level for IBM MQ.
The system resource RLIMIT_NPROC is set at an unusually low level for IBM MQ.
IBM MQ queue manager 'QM1' starting.
The queue manager is associated with installation 'Installation1'.
5 log records accessed on queue manager 'QM1' during the log replay phase.
Log replay for queue manager 'QM1' complete.
Transaction manager state recovered for queue manager 'QM1'.
IBM MQ queue manager 'QM1' started using V9.2.0.1.
[mqm@ip-172-31-14-154 ~]$ runmqsc QM1
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager QM1.


DEFINE LISTENER(QM1.LST) TRPTYPE(TCP) CONTROL(QMGR) PORT(1414)
     3 : DEFINE LISTENER(QM1.LST) TRPTYPE(TCP) CONTROL(QMGR) PORT(1414)
AMQ8626I: IBM MQ listener created.
START LISTENER(QM1.LST)
     4 : START LISTENER(QM1.LST)
AMQ8021I: Request to start IBM MQ listener accepted.
DEFINE QL(QM1.XMITQ) USAGE(XMITQ)
     5 : DEFINE QL(QM1.XMITQ) USAGE(XMITQ)
AMQ8006I: IBM MQ queue created.
               
 
DEFINE CHANNEL(TO.QM2) CHLTYPE(SDR) CONNAME('ec2-18-218-83-33.us-east-2.compute.amazonaws.com(1415)') XMITQ(QM1.XMITQ) TRPTYPE(TCP)
    10 : DEFINE CHANNEL(TO.QM2) CHLTYPE(SDR) CONNAME('ec2-18-218-83-33.us-east-2.compute.amazonaws.com(1415)') XMITQ(QM1.XMITQ) TRPTYPE(TCP)
AMQ8014I: IBM MQ channel created.
         
 
DEFINE CHANNEL(TO.QM1) CHLTYPE(RCVR) TRPTYPE(TCP)
    12 : DEFINE CHANNEL(TO.QM1) CHLTYPE(RCVR) TRPTYPE(TCP)
AMQ8014I: IBM MQ channel created.

       : 
START CHANNEL(TO.QM2)
    13 : START CHANNEL(TO.QM2)
AMQ8018I: Start IBM MQ channel accepted.
DIS CHS(*)
    14 : DIS CHS(*)
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.QM2)                         CHLTYPE(SDR)
   CONNAME(172.31.14.154(1415))            CURRENT
   RQMNAME(QM2)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(QM1.XMITQ)
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.QM1)                         CHLTYPE(RCVR)
   CONNAME(172.31.14.154)                  CURRENT
   RQMNAME(QM2)                            STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
DEFINE QL(QM1.QL)
    15 : DEFINE QL(QM1.QL)
AMQ8006I: IBM MQ queue created.
DEFINE QR(QM2.QR) RNAME(QM2.QL) RQMNAME(QM2) XMITQ(QM1.XMITQ)
    16 : DEFINE QR(QM2.QR) RNAME(QM2.QL) RQMNAME(QM2) XMITQ(QM1.XMITQ)
AMQ8006I: IBM MQ queue created.

       : 
DIS QL(QM*)
    17 : DIS QL(QM*)
AMQ8409I: Display Queue details.
   QUEUE(QM1.QL)                           TYPE(QLOCAL)
AMQ8409I: Display Queue details.

   QUEUE(QM1.XMITQ)                        TYPE(QLOCAL)

On QM2

[mqm@ip-172-31-14-154 ~]$ dspmq
[mqm@ip-172-31-14-154 ~]$ crtmqm QM2
IBM MQ queue manager created.
Directory '/var/mqm/qmgrs/QM2' created.
The queue manager is associated with installation 'Installation1'.
Creating or replacing default objects for queue manager 'QM2'.
Default objects statistics : 83 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.
[mqm@ip-172-31-14-154 ~]$ strmqm QM2
The system resource RLIMIT_NOFILE is set at an unusually low level for IBM MQ.
The system resource RLIMIT_NPROC is set at an unusually low level for IBM MQ.
IBM MQ queue manager 'QM2' starting.
The queue manager is associated with installation 'Installation1'.
5 log records accessed on queue manager 'QM2' during the log replay phase.
Log replay for queue manager 'QM2' complete.
Transaction manager state recovered for queue manager 'QM2'.
IBM MQ queue manager 'QM2' started using V9.2.0.1.
[mqm@ip-172-31-14-154 ~]$ runmqsc QM2
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager QM2.


DEFINE LISTENER(QM2.LST) TRPTYPE(TCP) CONTROL(QMGR) PORT(1415)
     1 : DEFINE LISTENER(QM2.LST) TRPTYPE(TCP) CONTROL(QMGR) PORT(1415)
AMQ8626I: IBM MQ listener created.
START LISTENER(QM2.LST)
     2 : START LISTENER(QM2.LST)
AMQ8021I: Request to start IBM MQ listener accepted.
DEFINE QL(QM2.XMITQ) USAGE(XMITQ)
     3 : DEFINE QL(QM2.XMITQ) USAGE(XMITQ)
AMQ8006I: IBM MQ queue created.

 
DEFINE CHANNEL(TO.QM1) CHLTYPE(SDR) CONNAME('ec2-18-218-83-33.us-east-2.compute.amazonaws.com(1414)')
XMITQ(QM2.XMITQ) TRPTYPE(TCP)
     5 : DEFINE CHANNEL(TO.QM1) CHLTYPE(SDR) CONNAME('ec2-18-218-83-33.us-east-2.compute.amazonaws.com(1414)') XMITQ(QM2.XMITQ) TRPTYPE(TCP)
AMQ8014I: IBM MQ channel created.
DEFINE CHANNEL(TO.QM2) CHLTYPE(RCVR) TRPTYPE(TCP) 
     6 : DEFINE CHANNEL(TO.QM2) CHLTYPE(RCVR) TRPTYPE(TCP) 
AMQ8014I: IBM MQ channel created.


       : 
START CHANNEL(TO.QM1)
     7 : START CHANNEL(TO.QM1)
AMQ8018I: Start IBM MQ channel accepted.
DIS CHS(*)
     8 : DIS CHS(*)
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.QM2)                         CHLTYPE(RCVR)
   CONNAME(172.31.14.154)                  CURRENT
   RQMNAME(QM1)                            STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.QM1)                         CHLTYPE(SDR)
   CONNAME(172.31.14.154(1414))            CURRENT
   RQMNAME(QM1)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(QM2.XMITQ)

       : 
DEFINE QL(QM2.QL)
     9 : DEFINE QL(QM2.QL)
AMQ8006I: IBM MQ queue created.

       : 
DEFINE QR(QM1.QR) RNAME(QM1.QL) RQMNAME(QM1) XMITQ(QM2.XMITQ)
    10 : DEFINE QR(QM1.QR) RNAME(QM1.QL) RQMNAME(QM1) XMITQ(QM2.XMITQ)
AMQ8006I: IBM MQ queue created.

       : 
DIS QL(QM*)
    11 : DIS QL(QM*)
AMQ8409I: Display Queue details.
   QUEUE(QM2.QL)                           TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(QM2.XMITQ)                        TYPE(QLOCAL)

Now all the channels are running and also queue are available . Let us test message on both the ways using amqsget/amqsput programs .

QM1 to QM2 Message flow

QM2 to QM1 Message flow

Some Explanation & Notes to remember .

  1. Remote queues doesn’t hold any messages .It is a reference to the actual queue on the remote queue manager local queue .So there will not be any curdepth or maxdepth attribute for this queue
DISPLAY QREMOTE(QM*) ALL
     3 : DISPLAY QREMOTE(QM*) ALL
AMQ8409I: Display Queue details.
   QUEUE(QM1.QR)                           TYPE(QREMOTE)
   ALTDATE(2021-01-01)                     ALTTIME(12.56.20)
   CLUSNL( )                               CLUSTER( )
   CLWLPRTY(0)                             CLWLRANK(0)
   CUSTOM( )                               DEFBIND(OPEN)
   DEFPRTY(0)                              DEFPSIST(NO)
   DEFPRESP(SYNC)                          DESCR( )
   PUT(ENABLED)                            RQMNAME(QM1)
   RNAME(QM1.QL)                           SCOPE(QMGR)
   XMITQ(QM2.XMITQ)                   

2 When we put message to Remote queue by connection to qmgr message will first go to the XMITQ then channel program will take the message through the SDR-RCVR channel to Remote Local QUEUE .If the XMITQ is full then application at sender side cannot put the message .

DISPLAY QLOCAL(QM1.XMITQ) CURDEPTH MAXDEPTH USAGE
     5 : DISPLAY QLOCAL(QM1.XMITQ) CURDEPTH MAXDEPTH USAGE
AMQ8409I: Display Queue details.
   QUEUE(QM1.XMITQ)                        TYPE(QLOCAL)
   CURDEPTH(0)                             MAXDEPTH(5000)
   USAGE(XMITQ)                         

3.If the channel’s are down .Still application able to put the message to QMGR . message will be stored in XMITQ .Once the channel is up then the message will transferred .

Hope this gives some good insight on Point-To-Point Standalone setup .

Refer give link for MQ cluster setup

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *