. IBM WebSphere MQ v6.0
. Ex 6 - IBM WebSphere MQ Client Implementation.
. 讓我們來練習一下 MQ Client Implementation
.
=== Exercise 6 : WebSphereMQ Client Implementation ===
What we will do :
A. Configure a Server for client connection.
B. Configure a client.
C. Test a client to server environment.
D. Use Auto-Definition of a CHANNEL.
E. Setup and perform Remote Administration.
=== Sample programs for MQ client ===
1. # amqsputc QName [QMgrName]
(This program is invoked the same way as amqsput and has the same parameter structure. But it connects to a WebSphereMQ client instead of a WebSphereMQ Server.)
2. # amqsbcgc QName [QMgrName]
(This program is invoked the same way as amqsbcg and has the same parameter structure but it connects to a WebSphereMQ client)
3. # amqsgetc QName [QMgrName]
(This program is invoked the same way as amqsget and has the same parameter structure but it connects to a WebSphereMQ client)
======================================================
[A. Server Queue Manager setup]
1. Create Queue Manager named QMC06 , and QMC07R :
# crtmqm QMC06 # crtmqm QMC07R
# strmqm QMC06 # strmqm QMC07R
# runmqsc QMC06 # runmqsc QMC07R
(on QMC06)
: DEF QL(DLQ) REPLACE
: ALTER QMGR DEADQ(DLQ)
: DEF QL(XQMC07R) REPLACE USAGE(XMITQ)
: DEF CHL(QMC06.TO.QMC07R) CHLTYPE(SDR) REPLACE +
TRPTYPE(TCP) CONNAME('Host2(9007)') XMITQ(XQMC07R)
(on QMC07R)
: DEF QL(DLQ) REPLACE
: ALTER QMGR DEADQ(DLQ)
: DEF CHL(QMC06.TO.QMC07R) CHLTYPE(RCVR) REPLACE +
TRPTYPE(TCP)
: DEF QL(QL.A) REPLACE
(on QMC06)
: DEF QR(QRMT07R) REPLACE +
RNAME(QL.A) RQMNAME(QMC07R) XMITQ(XQMC07R)
(on QMC07R)
# runmqlsr -m QMC07R -t TCP -p 9007
(on QMC06, CHANNEL 啟動狀態)
# runmqchl -C QMC06.TO.QMC07R -m QMC06
# amqsput QRMT07R QMC06 (測試通道是否暢通)
2. Define a SVRCONN CHANNEL on QMC07R to make it connectable by clients :
a. Use QMC07R_CLNT as the CHANNEL name.
b. Protocol is TCP.
# runmqsc QMC07R
: DEFINE CHL(QMC07R_CLNT) CHLTYPE(SVRCONN) REPLACE TRPTYPE(TCP)
3. Be sure that an appropriate Listener function is avtive for the Server QM.
# runmqlsr -m QMC07R -t TCP -p 9007
[B. Client setup (Method 1)]
4. Use the MQSERVER environment variable to provide a client-connection CHANNEL Definition to be able to connect to the Queue Manager.
(UNIX / Linux Systems)
# export MQSERVER=QMC07R_CLNT/TCP/QMC07R(9007)
(Windows Systems)
# SET MQSERVER=QMC07R_CLNT/TCP/QMC07R(9007)
[C. Test the Client connection (Setup Method 1)]
5. Use amqsputc to put messages on the Local Queue QL.A on the Server :
# amqsputc QL.A QMC07R
6. Use amqsbcgc to browse the message on the Server Queue.
(The value of Reply-to-QMgr in the MQMD will show.)
# amqsbcgc QL.A QMC07R
7. Use amqsgetc to get the messages from the Server Queue.
# amqsgetc QL.A QMC07R
[D. Server Queue Manager setup using Auto-Definition of CHANNELs]
8. Enable CHANNEL Auto-Definition in Queue Manager.
so all teams are able to connect to Queue Manager
: ALTER QMGR CHAD(ENABLED)
[E. Client Setup (Method 2)]
9. Use QMC07R to build a client CHANNEL definition table to enable a WebSphereMQ
client to connect to each Queue Manager which has enabled CHANNEL Auto-Definition :
a. Create 2 client connection CHANNEL entries to connect to QMC07R.
(On QMC07R)
: DEF CHL(CLNT_A) CHLTYPE(CLNTCONN) REPLACE +
TRPTYPE(TCP) CONNAME('QMC07R(9007)') QMNAME(QMC07R)
: DEF CHL(CLNT_B) CHLTYPE(CLNTCONN) REPLACE +
TRPTYPE(TCP) CONNAME('QMC07R(9007)') QMNAME(QMC07R)
[F. Test the Client connection (Setup Method 2)] (需安裝MQ Client並設定)
10. On the client system ensure the following environment variables are point to the just
created client CHANNEL definition table. Be sure to unset the MQSERVER.
a. MQCHLLIB=
b. MQCHLTAB=
[UNIX Systems]
Default location on the creating Queue Manager :
export MQCHLLIB=/var/mqm/qmgrs/
export MQCHLTAB=amqclchl.tab
export MQSERVER=
[Windows Systems]
SET MQCHLLIB=..\mqm\qmgrs\
SET MQCHLTAB=amqclchl.tab
SET MQSERVER=
11. Use amqsputc again to put a message to QL.A on QMC07R and ensure the
operation is completed successfully. Verify that the new server connect CHANNEL
CLNT_A is now defined on QMC07R.
# amqsputc QL.A QMC07R
12. Stop CHANNEL CLNT_A . Then use amqsputc to put a message to QL.A . Verify
that the new server connect CHANNEL CLNT_B is now defined on QMC07R, and
that the message successfully arrived on the Queue.
# runmqsc QMC07R
: stop CHANNEL(CLNT_A)
# amqsputc QL.A QMC07R
======================================================
======================================================
[G. Setup and perform Remote Administration.]
1. This requires that the managing Queue Manager be the default Queue Manager :
2. # runmqsc -w 15
3. : DISPLAY QMGR
沒有留言:
張貼留言