Friday 16 April 2010

MQ v7 example to make connection

Structure:
Qremote -- transmissionQ(XmitQ) -- channel -- RemoteServer:listener -- RemoteServer:Qlocal

Qremote:
===> Just a shadow of remoteQL
runmqsc
def qr(nameQR ex. QRMTYY) rname( nameQL on remote server : QL.AY) rqmname( nameQM remote : QMCYY) +
xmitq(QMCYY)

Note : xmitq is optional, if u use default,by default it will go to xmitq whose name same as rqmname. That is why if no xmitq with same name with rqmname: 'amqsput QremoteName' will show error.
If you use uncommon name for the xmitQ (different name with the rqmname), you must put parameter xmitq there.


XmitQ
==> Queue Gateway of all Qremote using this value XmitQ as parameter
runmqsc
def ql(QMCYY) usage (xmitq)


Channel
==> Defining to where, hostname and port of remote server.
runmqsc
def chl(qmcxx.qmcyy) chltype(sdr) trptype(tcp) conname ('ip(port)') xmitq(qmcYY)

Note : this channel will be used by this xmitQ

>>>>>>>>>>>>>>>>>>>>>
BTW, you need to set deadletterQ as well:
runmqsc
def ql(DQL)
alter qmgr deadq(dlq)
>>>>>>>>>>>>>>>>>>>>>>


AT REMOTE SERVER:

listener
runmqlsr -t TCP -p 90XX -m qmgrname

Note : after this you create channel receiver : def chl(xxx) chltype(rcvr) trptype(tcp)
dont forget to create qlocal (QL.AY)


BACK TO LOCAL SERVER


TESTING:
runmqsc
ping chl (qmcxx.qmcyy) ==> this one only test if remote listener port open
runmqchl -c qmcxx.qmcyy -m qmgrname ==> activate channel (has dependancy on listener port AND correct name of xmitQ existence)


PUTTING MESSAGE:
amqsput Qremote (qmgrname)
==> remember this is just shadow, message will go to xmitQ name related
-=> So check it with amqsbcg/gbr xmitQname (to see if message stuck in local server)
amqsgbr is more concise than amqsbcg.


CHECKING MESSAGE @remote server:
amqsgbr QL.AY (qmgrname)
amqsbcg QL.AY (qmgrname)

NOW, if you wanna set message goes to DeadletterQ (when everything is ok):
amqsput XmitQname
==> because channel doesnt know where to transfer it (unlike QR which has Qlocal of remote server)
==> And of course the DeadletterQ is in the local server.

NOW, if channel failed, and you use that : amqsput XmitQname,
it will go to XmitQ, test by : amqsgbr xmitQname.


ADDITOINALLY:
crtmqm -q qmgrname (make it as default qmgr)

No comments:

Post a Comment