Routing Messages from external qmgr to gateway queue manager that are external to the cluster.

Messages can also be routed to a gateway queue manager from queue managers that are external to the cluster. Ex Applicaiton have its own QMGR non-cluster and it connects to GWQM . If the Applicaiton side has another MQ cluster then GR will be used to OverLap two cluster’s

APPQM1 –> GWQM –> FR2/FR2

APPQM1 is external QMGR outside of cluster connecting to Gateway QMGR GWQM

Green highlighted QMGR’s are part of Cluster .

In Our scenario we used below QMGR names

QM3 –>APPQM1

QM1–>GWQM

QM2 –> FR1

QM4–> FR2

LQ1 ,RES Queues

on APPQM1

DEFINE QL(GWQM) USAGE(XMITQ)
 DEFINE CHANNEL(APPQM1.TO.GWQM) CHLTYPE(SDR) TRPTYPE(TCP) CONNAME('172.31.14.154(51414)') XMITQ(GWQM)
 DEFINE QREMOTE(REQ) RNAME(QL1) RQMNAME(DUMMY) XMITQ(GWQM)

DEFINE QREMOTE(REQ) RNAME(QL1) RQMNAME(DUMMY) XMITQ(GWQM)
     1 :  DEFINE QREMOTE(REQ) RNAME(QL1) RQMNAME(DUMMY) XMITQ(GWQM)
AMQ8006I: IBM MQ queue created.

ON GWQM

DEFINE CHANNEL(APPQM1.TO.GWQM) CHLTYPE(RCVR) TRPTYPE(TCP) 
DEFINE QREMOTE(DUMMY) RNAME('')  RQMNAME('')

define qremote(dummy)
     1 : define qremote(dummy)
AMQ8006I: IBM MQ queue created.
dis qr(dummy)
     2 : dis qr(dummy)
AMQ8409I: Display Queue details.
   QUEUE(DUMMY)                            TYPE(QREMOTE)
   ALTDATE(2021-01-03)                     ALTTIME(09.05.50)
   CLUSNL( )                               CLUSTER( )
   CLWLPRTY(0)                             CLWLRANK(0)
   CUSTOM( )                               DEFBIND(OPEN)
   DEFPRTY(0)                              DEFPSIST(NO)
   DEFPRESP(SYNC)                          DESCR( )
   PUT(ENABLED)                            RQMNAME( )
   RNAME( )                                SCOPE(QMGR)
   XMITQ( )   

Tried to send 10 Messages to QL1 from APPQM1 QMGR

bash-4.4$ for each in FR1 FR2 ; do  echo "dis qs(QL1) "|runmqsc $each; done
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR1.


     1 : dis qs(QL1) 
AMQ8450I: Display queue status details.
   QUEUE(QL1)                              TYPE(QUEUE)
   CURDEPTH(4)                             CURFSIZE(1)
   CURMAXFS(2088960)                       IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(1)
   QTIME( , )                              UNCOM(NO)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR2.


     1 : dis qs(QL1) 
AMQ8450I: Display queue status details.
   QUEUE(QL1)                              TYPE(QUEUE)
   CURDEPTH(6)                             CURFSIZE(1)
   CURMAXFS(2088960)                       IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(1)
   QTIME( , )                              UNCOM(NO)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
bash-4.4$

Sent 100 messages

5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR1.


     1 : dis qs(QL1) 
AMQ8450I: Display queue status details.
   QUEUE(QL1)                              TYPE(QUEUE)
   CURDEPTH(54)                            CURFSIZE(1)
   CURMAXFS(2088960)                       IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(1)
   QTIME( , )                              UNCOM(NO)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR2.


     1 : dis qs(QL1) 
AMQ8450I: Display queue status details.
   QUEUE(QL1)                              TYPE(QUEUE)
   CURDEPTH(56)                            CURFSIZE(1)
   CURMAXFS(2088960)                       IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(1)
   QTIME( , )                              UNCOM(NO)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.

See Messages Arrives to FR1/Fr1 from APPQM1

On GWQM we have created qmgr alias . And it was referenced in the actual remote queue definition on APPQ1 . when the message arrives GWQM then qmgr alias will redirect the message to destination Queue .

DEFINE QREMOTE(DUMMY) RNAME(”) RQMNAME(”)

Determining the destination when receiving messages
When a queue manager receives a message, it looks in the transmission header to see the name of the destination queue and queue manager. If it has a queue-manager alias definition with the same name as the queue manager referenced, it substitutes the RQMNAME from its definition for the queue manager name in the transmission header.
There are two reasons for using a queue-manager alias in this way:

1.To direct messages to another queue manager
2.To alter the queue manager name to be the same as the local queue manager

Now we will see message flow from FR1/FR2 –> GWQM –> APPQM1

On GWQM

 DEFINE QL(APPQM1) USAGE(XMITQ)
 DEFINE CHANNEL(GWMQ.TO.APPQM1) CHLTYPE(SDR) TRPTYPE(TCP) CONNAME('172.31.14.154(1417)') XMITQ(APPQM1)
START CHANNEL(GWMQ.TO.APPQM1)
 DEFINE QREMOTE(RES) RNAME(RES) XMITQ(APPQM1) CLUSTER(TEST)

On APPQM1

DEFINE LISTENER(APPQM1.LST) TRPTYPE(TCP) PORT(1417) CONTROL(QMGR)
start  LISTENER(APPQM1.LST) 
 DEFINE CHANNEL(GWMQ.TO.APPQM1) CHLTYPE(RCVR) TRPTYPE(TCP) 
 DEFINE QL(RES)
bash-4.4$ runmqsc APPQM1
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager APPQM1.

DEFINE LISTENER(APPQM1.LST) TRPTYPE(TCP) PORT(1417) CONTROL(QMGR)
     2 : DEFINE LISTENER(APPQM1.LST) TRPTYPE(TCP) PORT(1417) CONTROL(QMGR)
AMQ8626I: IBM MQ listener created.
start  LISTENER(APPQM1.LST) 
     3 : start  LISTENER(APPQM1.LST) 
AMQ8021I: Request to start IBM MQ listener accepted.
 DEFINE CHANNEL(GWMQ.TO.APPQM1) CHLTYPE(RCVR) TRPTYPE(TCP) 
     4 :  DEFINE CHANNEL(GWMQ.TO.APPQM1) CHLTYPE(RCVR) TRPTYPE(TCP) 
AMQ8014I: IBM MQ channel created.
 DEFINE QL(RES)
     5 :  DEFINE QL(RES)
AMQ8006I: IBM MQ queue created.
end
     6 : end
5 MQSC commands read.
No commands have a syntax error.
All valid MQSC commands were processed.
bash-4.4$ runmqsc GWQM
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager GWQM.

 DEFINE QL(APPQM1) USAGE(XMITQ)
     1 :  DEFINE QL(APPQM1) USAGE(XMITQ)
AMQ8006I: IBM MQ queue created.
 DEFINE CHANNEL(GWMQ.TO.APPQM1) CHLTYPE(SDR) TRPTYPE(TCP) CONNAME('172.31.14.154(1417)') XMITQ(APPQM1)
     2 :  DEFINE CHANNEL(GWMQ.TO.APPQM1) CHLTYPE(SDR) TRPTYPE(TCP) CONNAME('172.31.14.154(1417)') XMITQ(APPQM1)
AMQ8014I: IBM MQ channel created.
 DEFINE QREMOTE(RES) RNAME(RES) XMITQ(APPQM1) CLUSTER(TEST
     3 :  DEFINE QREMOTE(RES) RNAME(APPQM1) XMITQ(APPQM1) CLUSTER(TEST)
AMQ8006I: IBM MQ queue created.
end
     4 : end
3 MQSC commands read.
No commands have a syntax error.
All valid MQSC commands were processed.
bash-4.4$ 

No need to create anything for responce in FR1/Fr2 because the cluster remote queue created in GRQM is visible to FR1/FR1 so it can send the message .Let us try to send message to RES Queue on APPQM1 from FR1 & FR2

[mqm@ip-172-31-14-154 tmp]$ /opt/mqm/samp/bin/amqsget RES FR1
Sample AMQSGET0 start
MQOPEN ended with reason code 2085
unable to open queue for input
Sample AMQSGET0 end
[mqm@ip-172-31-14-154 tmp]$ /opt/mqm/samp/bin/amqsput RES FR1
Sample AMQSPUT0 start
target queue is RES
AAA
BBB

Sample AMQSPUT0 end
[mqm@ip-172-31-14-154 tmp]$ /opt/mqm/samp/bin/amqsput RES FR2
Sample AMQSPUT0 start
target queue is RES
CCC
DDD

Sample AMQSPUT0 end

Try to get the message from RES in APPQM1

[mqm@ip-172-31-14-154 tmp]$ /opt/mqm/samp/bin/amqsget RES APPQM1
Sample AMQSGET0 start
message <AAA>
message <BBB>
message <CCC>
message <DDD>

That’s it We have successfully able to send both request and receive response messages . Now we can have As many as QMGR’s connect to GWQM like APPQM2 APPQM3 ….etc

If the transmission queue is piling up due to the high load . you can avoid the situation by addition additional set of channels . if we have multiple routes to the destination the MQ program distribute the load using round robin algorithm . If there is any channel priority then make sure the same are set otherwise which ever channel has highest priority that will be used and underline transmit queue will be used.

refer below definitions

GW

DEFINE QLOCAL(FR1.XMITQ) USAGE(XMITQ) CLCHNAME(TO.FR1_2)
DEFINE QLOCAL(FR2.XMITQ) USAGE(XMITQ) CLCHNAME(TO.FR2_2)

DEFINE CHANNEL(TO.FR1_2) CHLTYPE(CLUSSDR) TRPTYPE(TCP) CONNAME('localhost(11414)') CLUSTER(TEST) clwlprty(6)
DEFINE CHANNEL(TO.FR2_2) CHLTYPE(CLUSSDR) TRPTYPE(TCP) CONNAME('localhost(11415)') CLUSTER(TEST) clwlprty(4)
DEFINE CHANNEL(TO.GW_2) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('localhost(11416)') CLUSTER(TEST)

FR1

DEFINE QLOCAL(GW.XMITQ) USAGE(XMITQ) CLCHNAME(TO.GW_2)
DEFINE QLOCAL(FR2.XMITQ) USAGE(XMITQ) CLCHNAME(TO.FR2_2)

DEFINE CHANNEL(TO.GW_2) CHLTYPE(CLUSSDR) TRPTYPE(TCP) CONNAME('localhost(11416)') CLUSTER(TEST)
DEFINE CHANNEL(TO.FR2_2) CHLTYPE(CLUSSDR) TRPTYPE(TCP) CONNAME('localhost(11415)') CLUSTER(TEST)
DEFINE CHANNEL(TO.FR1_2) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('localhost(11414)') CLUSTER(TEST) clwlprty(6)

FR2

DEFINE QLOCAL(GW.XMITQ) USAGE(XMITQ) CLCHNAME(TO.GW_2)
DEFINE QLOCAL(FR1.XMITQ) USAGE(XMITQ) CLCHNAME(TO.FR1_2)

DEFINE CHANNEL(TO.GW_2) CHLTYPE(CLUSSDR) TRPTYPE(TCP) CONNAME('localhost(11416)') CLUSTER(TEST)
DEFINE CHANNEL(TO.FR1_2) CHLTYPE(CLUSSDR) TRPTYPE(TCP) CONNAME('localhost(11414)') CLUSTER(TEST)
DEFINE CHANNEL(TO.FR2_2) CHLTYPE(CLUSRCVR)  TRPTYPE(TCP) CONNAME('localhost(11415)') CLUSTER(TEST) clwlprty(4)

dis chs(TO.GW_2) msgs

use above command to check how many messages are transmitted and also verify the transmit queue .

If we have one channel in retrying mode then which ever channel is up that will be used to route the message to the destination queue manager

       :
dis chs(TO.FR1_2) msgs
     2 : dis chs(TO.FR1_2) msgs
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR1_2)                       CHLTYPE(CLUSSDR)
   CONNAME(localhost(11414))               CURRENT
   MSGS(0)                                 RQMNAME(FR1)
   STATUS(RETRYING)                        SUBSTATE( )
   XMITQ(FR1.XMITQ)

       :
dis chs(TO.FR1) msgs
     3 : dis chs(TO.FR1) msgs
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR1)                         CHLTYPE(CLUSSDR)
   CONNAME(127.0.0.1(11414))               CURRENT
   MSGS(5)                                 RQMNAME(FR1)
   STATUS(RUNNING)                         SUBSTATE(MQGET)
   XMITQ(SYSTEM.CLUSTER.TRANSMIT.QUEUE)

Related Posts

Leave a Reply

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