MultiHopping with 3 Managers

Requirement: To set up a minimal steps for a Two Way MQ communication between two queue managers ie From A to B & From B to C

Passing the messages between more than one intermediate queue managers is called Multi-Hopping. Multi-hopping occurs when a message needs to traverse one or more queue-managers in order to reach the destination queue-manager.

The Setup in which a QMGR is networked with the next QMGR which is networked to the next QMGR ie  (QMA -> QMB -> QMC -> QMD -> QME).

If a message is created on QMA, and the destination queue-manager is on QME, then the message must flow from QMB to QMC, to QMD to QME.

QMB and QMC will need a queue-manager aliases since they are non-adjacent (don’t have a transmission queue) to the destination queue-manager.

QMB needs a definition to move the message from QMB to the next hop QMC. and so on

So, when the message arrives on QMB, a queue-manager alias must exist to resolve the queue-manager name in the XQH (transmission queue header):
DEF QR(QME) RQMname(QME) XMITQ(QMC).

This definition tells the MCA (message channel agent) on QMB to move the message to transmission queue named QMC, so that the message will be sent to QMC.

When the message arrives on QMC, again a queue-manager alias will be need to be defined  to move the message to a transmission queue named QMD:
DEF QR(QME) RQMname(QME) XMITQ(QMD).

So QMA doesn’t know any thing about QME so by defining the QM alias the message is reached to the destination QME.

The only thing and the only route that QMA knows is how to get to QMB. Everything else is resolved at QMB. So as long as QMB is secured, then no application can send messages to QMC without going through QMB.

Quick Reference Commands for Multi Hopping with 3 QMGRS

On Queue Manager A :

crtmqm A
strmqm A
runmqsc A
DEFINE QLOCAL(A.TQ) USAGE(XMITQ)
DEFINE CHANNEL(A.B) CHLTYPE(SDR) CONNAME(‘192.20.20.21(6001)’) XMITQ(A.TQ)
DEFINE QREMOTE(C.RQ) RNAME(C.LQ) RQMNAME(C) XMITQ(A.TQ)
START CHANNEL(A.B)
DISPLAY CHSTATUS(*)

On Queue Manager B :

crtmqm B
strmqm B
runmqsc B
DEFINE CHANNEL(A.B) CHLTYPE(RCVR)
DEFINE QLOCAL(B.TQ) USAGE(XMITQ)
DEFINE LISTENER(B.LSTR) TRPTYPE(TCP) PORT(6001) IPADDR(192.20.20.21)
START LISTENER(B.LSTR)
DEFINE CHANNEL(B.C) CHLTYPE (SDR) TRPTYPE(TCP) CONNAME(‘192.20.20.21(6002)’) XMITQ(B.TQ)

— Qmgr Alias needs to be set in the QMB

DEFINE QREMOTE(C) RQMNAME(C) RNAME(”) XMITQ(B.TQ)
START CHANNEL(A.B)
START CHANNEL(B.C)
DISPLAY CHSTATUS()
DISPLAY LSSTATUS(
)

On Queue Manager C :

crtmqm C
strmqm C
runmqsc C
DEFINE LISTENER(C.LSTR) TRPTYPE(TCP) PORT(6002) IPADDR(192.20.20.21)
DEFINE CHANNEL(B.C) CHLTYPE(RCVR) TRPTYPE(TCP)
START LISTENER(C.LSTR)
DEFINE QLOCAL(C.LQ)
START CHANNEL(B.C)
DISPLAY CHSTATUS()
DISPLAY LSSTATUS(
)

Testing of MultiHopping :

In Windows Env :

C:\Program Files>cd IBM

C:\Program Files\IBM>cd “WebSphere MQ_1”

C:\Program Files\IBM\WebSphere MQ_1>cd bin

C:\Program Files\IBM\WebSphere MQ_1\bin>amqsput C.RQ A
Sample AMQSPUT0 start
target queue is C.RQ
test message1

Sample AMQSPUT0 end

C:\Program Files\IBM\WebSphere MQ_1\bin>amqsget C.LQ C
Sample AMQSGET0 start
message <test message1>
no more messages
Sample AMQSGET0 end

In Linux Env :

bash-3.2$ pwd
/opt/mqm/samp/bin
bash-3.2$ ./amqsput C.RQ A
Sample AMQSPUT0 start
target queue is C.RQ
This is a test
Sample AMQSPUT0 end
bash-3.2$ ./amqsbcg C.LQ C

 

————-RUNTIME OUTPUT————-

———————On Queue Manager A———————
C:\Program Files\IBM\IIB\10.0.0.6>crtmqm A
WebSphere MQ queue manager created.
Directory ‘C:\ProgramData\IBM\MQ\qmgrs\A’ created.
The queue manager is associated with installation ‘Installation1’.
Creating or replacing default objects for queue manager ‘A’.
Default objects statistics : 82 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.

C:\Program Files\IBM\IIB\10.0.0.6>strmqm A
WebSphere MQ queue manager ‘A’ starting.
The queue manager is associated with installation ‘Installation1’.
5 log records accessed on queue manager ‘A’ during the log replay phase.
Log replay for queue manager ‘A’ complete.
0 log records accessed on queue manager ‘A’ during the recovery phase.
Transaction manager state recovered for queue manager ‘A’.
WebSphere MQ queue manager ‘A’ started using V8.0.0.4.

C:\Program Files\IBM\IIB\10.0.0.6>

C:\Program Files\IBM\IIB\10.0.0.6>runmqsc A
5724-H72 (C) Copyright IBM Corp. 1994, 2015.
Starting MQSC for queue manager A.

DEFINE QLOCAL(A.TQ) USAGE(XMITQ)
1 : DEFINE QLOCAL(A.TQ) USAGE(XMITQ)
AMQ8006: WebSphere MQ queue created.
DEFINE CHANNEL(A.B) CHLTYPE(SDR) CONNAME(‘127.0.0.1(6001)’) XMITQ(A.TQ)
2 : DEFINE CHANNEL(A.B) CHLTYPE(SDR) CONNAME(‘127.0.0.1(6001)’) XMITQ(A.TQ)

AMQ8014: WebSphere MQ channel created.

:
DEFINE QREMOTE(C.RQ) RNAME(C.LQ) RQMNAME(C) XMITQ(A.TQ)
3 : DEFINE QREMOTE(C.RQ) RNAME(C.LQ) RQMNAME(C) XMITQ(A.TQ)
AMQ8006: WebSphere MQ queue created.

:
START CHANNEL(A.B)
4 : START CHANNEL(A.B)
AMQ8018: Start WebSphere MQ channel accepted.

:
DISPLAY CHSTATUS()
5 : DISPLAY CHSTATUS(
)
AMQ8417: Display Channel Status details.
CHANNEL(A.B) CHLTYPE(SDR)
CONNAME(127.0.0.1(6001)) CURRENT
RQMNAME( ) STATUS(RETRYING)
SUBSTATE( ) XMITQ(A.TQ)

——————On Queue Manager B—————————–

C:\Program Files\IBM\IIB\10.0.0.6>strmqm B
WebSphere MQ queue manager ‘B’ starting.
The queue manager is associated with installation ‘Installation1’.
5 log records accessed on queue manager ‘B’ during the log replay phase.
Log replay for queue manager ‘B’ complete.
Transaction manager state recovered for queue manager ‘B’.
WebSphere MQ queue manager ‘B’ started using V8.0.0.4.

C:\Program Files\IBM\IIB\10.0.0.6>runmqsc B
5724-H72 (C) Copyright IBM Corp. 1994, 2015.
Starting MQSC for queue manager B.

DEFINE CHANNEL(A.B) CHLTYPE(RCVR)
1 : DEFINE CHANNEL(A.B) CHLTYPE(RCVR)
AMQ8014: WebSphere MQ channel created.
DEFINE QLOCAL(B.TQ) USAGE(XMITQ)
2 : DEFINE QLOCAL(B.TQ) USAGE(XMITQ)
AMQ8006: WebSphere MQ queue created.

DEFINE LISTENER(B.LSTR) TRPTYPE(TCP) PORT(6001) IPADDR(127.0.0.1)
20 : DEFINE LISTENER(B.LSTR) TRPTYPE(TCP) PORT(6001) IPADDR(127.0.0.1)
AMQ8626: WebSphere MQ listener created.

START LISTENER(B.LSTR)
22 : START LISTENER(B.LSTR)
AMQ8021: Request to start WebSphere MQ listener accepted.

:
DEFINE CHANNEL(B.C) CHLTYPE (SDR) TRPTYPE(TCP) CONNAME(‘127.0.0.1(6002)’) XMITQ(B.TQ)
23 : DEFINE CHANNEL(B.C) CHLTYPE (SDR) TRPTYPE(TCP) CONNAME(‘127.0.0.1(6002)’) XMITQ(B.TQ)
AMQ8014: WebSphere MQ channel created.


DEFINE QREMOTE(C) RQMNAME(C) RNAME(”) XMITQ(B.TQ)
1 : DEFINE QREMOTE(C) RQMNAME(C) RNAME(”) XMITQ(B.TQ)
AMQ8006: WebSphere MQ queue created.

:
START CHANNEL(A.B)
2 : START CHANNEL(A.B)
AMQ9514: Channel ‘A.B’ is in use.

:
START CHANNEL(B.C)
3 : START CHANNEL(B.C)
AMQ8018: Start WebSphere MQ channel accepted.

:
DISPLAY CHSTATUS()
4 : DISPLAY CHSTATUS(
)
AMQ8417: Display Channel Status details.
CHANNEL(A.B) CHLTYPE(RCVR)
CONNAME(127.0.0.1) CURRENT
RQMNAME(A) STATUS(RUNNING)
SUBSTATE(RECEIVE)
AMQ8417: Display Channel Status details.
CHANNEL(B.C) CHLTYPE(SDR)
CONNAME(127.0.0.1(6002)) CURRENT
RQMNAME( ) STATUS(RETRYING)
SUBSTATE( ) XMITQ(B.TQ)

:
DISPLAY LSSTATUS()
5 : DISPLAY LSSTATUS(
)
AMQ8631: Display listener status details.
LISTENER(B.LSTR) STATUS(RUNNING)
PID(2356)

——————On Queue Manager C————————

C:\Program Files\IBM\IIB\10.0.0.6>crtmqm C
WebSphere MQ queue manager created.
Directory ‘C:\ProgramData\IBM\MQ\qmgrs\C’ created.
The queue manager is associated with installation ‘Installation1’.
Creating or replacing default objects for queue manager ‘C’.
Default objects statistics : 82 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.

C:\Program Files\IBM\IIB\10.0.0.6>strmqm C
WebSphere MQ queue manager ‘C’ starting.
The queue manager is associated with installation ‘Installation1’.
5 log records accessed on queue manager ‘C’ during the log replay phase.
Log replay for queue manager ‘C’ complete.
Transaction manager state recovered for queue manager ‘C’.
WebSphere MQ queue manager ‘C’ started using V8.0.0.4.

C:\Program Files\IBM\IIB\10.0.0.6>runmqsc C
5724-H72 (C) Copyright IBM Corp. 1994, 2015.
Starting MQSC for queue manager C.

DEFINE LISTENER(C.LSTR) TRPTYPE(TCP) PORT(6002) IPADDR(127.0.0.1)
1 : DEFINE LISTENER(C.LSTR) TRPTYPE(TCP) PORT(6002) IPADDR(127.0.0.1)
AMQ8626: WebSphere MQ listener created.

:
DEFINE CHANNEL(B.C) CHLTYPE(RCVR) TRPTYPE(TCP)
2 : DEFINE CHANNEL(B.C) CHLTYPE(RCVR) TRPTYPE(TCP)
AMQ8014: WebSphere MQ channel created.

:
START LISTENER(C.LSTR)
3 : START LISTENER(C.LSTR)
AMQ8021: Request to start WebSphere MQ listener accepted.

:
DEFINE QLOCAL(C.LQ)
4 : DEFINE QLOCAL(C.LQ)
AMQ8006: WebSphere MQ queue created.

:
START CHANNEL(B.C)
5 : START CHANNEL(B.C)
AMQ8018: Start WebSphere MQ channel accepted.

:
DISPLAY CHSTATUS()
6 : DISPLAY CHSTATUS(
)
AMQ8420: Channel Status not found.

:
DISPLAY LSSTATUS()
7 : DISPLAY LSSTATUS(
)
AMQ8631: Display listener status details.
LISTENER(C.LSTR) STATUS(RUNNING)
PID(18356)

:
DISPLAY CHSTATUS()
8 : DISPLAY CHSTATUS(
)
AMQ8417: Display Channel Status details.
CHANNEL(B.C) CHLTYPE(RCVR)
CONNAME(127.0.0.1) CURRENT
RQMNAME(B) STATUS(RUNNING)
SUBSTATE(RECEIVE)
Testing of MultiHopping :

C:\Program Files>cd IBM

C:\Program Files\IBM>cd “WebSphere MQ_1”

C:\Program Files\IBM\WebSphere MQ_1>cd bin

C:\Program Files\IBM\WebSphere MQ_1\bin>amqsput C.RQ A
Sample AMQSPUT0 start
target queue is C.RQ
test message1

Sample AMQSPUT0 end

C:\Program Files\IBM\WebSphere MQ_1\bin>amqsbcg C.LQ C

AMQSBCG0 – starts here


MQOPEN – ‘C.LQ’

 

MQGET of message number 1, CompCode:0 Reason:0
****Message descriptor****

StrucId : ‘MD ‘ Version : 2
Report : 0 MsgType : 8
Expiry : -1 Feedback : 0
Encoding : 546 CodedCharSetId : 437
Format : ‘MQSTR ‘
Priority : 0 Persistence : 0
MsgId : X’414D512041202020202020202020202011E4465B20003103′
CorrelId : X’000000000000000000000000000000000000000000000000’
BackoutCount : 0
ReplyToQ : ‘ ‘
ReplyToQMgr : ‘A ‘
** Identity Context
UserIdentifier : ‘30260 ‘
AccountingToken :
X’1601051500000052AAC868F89FB474235F636B4910060000000000000000000B’
ApplIdentityData : ‘ ‘
** Origin Context
PutApplType : ’11’
PutApplName : ‘PHERE MQ_1\bin64\amqsput.exe’
PutDate : ‘20180712’ PutTime : ‘05422558’
ApplOriginData : ‘ ‘

GroupId : X’000000000000000000000000000000000000000000000000’
MsgSeqNumber : ‘1’
Offset : ‘0’
MsgFlags : ‘0’
OriginalLength : ‘-1’

**** Message ****

length – 13 of 13 bytes

00000000: 7465 7374 206D 6573 7361 6765 31 ‘test message1 ‘

No more messages
MQCLOSE
MQDISC
C:\Program Files\IBM\WebSphere MQ_1\bin>

Leave a comment