How to Send message over multiple QMGR’s without any remote queue definition ?

Here we will see how we send message from QM1–> QM2–> QM3 without any remote queue definitions

define ql(QM3) usage(xmitq) and use this transimssion queue on QM1 sender andeQM2 Sender

amqsput LQ QM1 8208 0 QM3

above program add Transmission header to the message with Destination QMGR name QM3 connecting to QM1.

if we use just amqsput LQ QM1 then it look for LQ queue in QM1 and if doesnt find message will be routed to dead letter queue .

Even if you tries to put the message to Transmission queue directly like amqsput QM3 QM1 still the transmission header will not be added .

Transmission header added when we put the message on remote queue only initially .


This will try to put the message to LQ on QM3 from QM1 .so it looks for the Transmission Queue with the
Destination QMGR name and if it is there then it will put the message in TQ with Transmission Header. When the message moved to QM2 then it again looks for the transmission queue and look for the queue with destination qmgr name if found then the message will be put in the transmission queue . Sender will send to QM3 and receiver received it on Qm3 . Now in QM3 it will look for the transmission header with the name QM3 then it know he is the QM3 then looks for the destination QUEUE and put the message .

8208 and 0 are the hexa decimal codes for opening and closing the queue and it is mandatory for amqsput if you want to use 5th parameter .

if doesnt find TQ with the Destination QMGR name then it looks for QMGR alias with the Destination QMGR name .

QM1 –> QM2 –> QM3

Transmission QUEUE in QM1 and QM3 on the SENDER channels for message passing .

amqsput LQ QM1 8208 0 QM3

QMGR ALIAS
DEFINE QR(QR) RQMNAME(QM3) XMITQ(TQ) RQNAME(”)

if the RQ doesnt have a Remote Queue name then it is called as QMGR Alias .
Destination QMGR name is used as the RQ name and RQMNAME is also a Destination QMGR .

amqsput LQ QM1 8208 0 QM3
By default it looks for the QNAME name with Destination qMGR and add Transmission header and place in TQ

This type of sending message over multiple qmgr’s to a destination QMGR is called multi-hopping .middle QMGR QM2 called Gateway QMGR.

2 ways of sending

amqsput LQ QM1 8208 0 QM3
Using Transmission Queue QM3
Using QMGR Alias where we use custom Transmission queue TQ but with QM3 Alias

if we put mesage with amqsput LQ QM1 8208 0 QM3 .it looks for Transmission queue with the destinamtion QMGR name .if not found then looks for QMGR alias . here QMGR alias is a Remote Queue .

QMGR ALias can be used for something else

RQ(QM2) RQMNAME(QM3) QNAME(LQ)
amqsput LQ QM1 8208 0 QM2

This will tries to send message targeted to QM2 LQ but the queue is not there and transmaission Header is updated to QM3 then in in QM2 again seaches Tranmission queuue with QM3 and foarwared .

amqsput LQ QM1 8208 0 SALES

RQ(SALES) RQMNAME(QM2) XMIIT(TQ)

Programmer tries to put sales but it internally gives to QM2 .programmer will never no what is the end QMGR it will be . He knows it is sales . it gives better understanding and feel .

Finally Conclusion

MQ check Transmission header and send the message accordingly

MQ check the Destination QMGR with the Transmission queue name and if found then place message there

If MQ doesn’t find Transmission queue name with the name of destination qmgr then it will looks for the QMGR alias [ QMGR alias is nothing but a remote queue with the name of Destination QMGR ]

if the QMGR Alias has a different RQMNAME and some Transmission queue then it will keep the message on given Transmission queue with RQMNAME updated in the transmission header .

What happen if QMGR alias has both RQMNAME and XMITQ blank ??

Multi-hopping as discussed above refer below sample definitions to try out

Distributed Queuing –

crtmqm QM1
crtmqm QM2
crtmqm QM3

strmqm QM1
strmqm QM2
strmqm QM3

runmqsc QM3
define qlocal(LQ)
define channel(TO.QM3) chltype(rcvr)
define listener(L1) trptype(tcp) port(1503)
start listener(L1)
display lsstatus(L1)
end

runmqsc QM2
define qlocal(QM3) usage(xmitq)
define channel(TO.QM3) chltype(sdr) conname(‘localhost(1503)’) xmitq(QM3)
start channel(TO.QM2)
display chstatus(TO.QM2)
define channel(TO.QM2) chltype(rcvr)
define listener(L1) trptype(tcp) port(1502)
start listener(L1)
display lsstatus(L1)
end

runmqsc QM1
define qlocal(QM3) usage(xmitq)
define channel(TO.QM2) chltype(sdr) conname(‘localhost(1502)’) xmitq(QM3)
start channel(TO.QM2)
display chstatus(TO.QM2)
end

/opt/dev/samp/bin/amqsput LQ QM1 8208 0 QM3

Related Posts

Leave a Reply

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