.
. IBM WebSphere MQ v6.0
. Ex 4 - IBM WebSphere MQ Distributed Queueing.
. 讓我們來練習一下 Distributed Queueing.
. 兩個Queue Managers之間的連接
.
=== Exercise 4 : Distributed Queuing ===
What we will do :
A. Create the objects, required for Distributed Queue.
B. Configure and refresh the inet daemon.
C. Start message CHANNELs manually.
D. Create the required application objects.
E. Test the message flow using sample applications.
F'. Use Triggering in a distributed environment.
G'. Use the CHANNEL Initiator to start messages.
======================================================
[A. Create and configure the required connection objects.]
1. Use for the exercise again the Queue manager with circular logging.
# crtmqm QMC01 (Local Qmgr , 送端SDR)
# crtmqm QMC02 (Remote Qmgr , 接收端RCVR)
# strmqm QMC01
# strmqm QMC02
2. Be sure that NO CHANNEL Initiator (runmqchi) is running.
3. Define the WebSphereMQ objects required for a connection between your
Local Queue Manager and the Queue Manager of your partner team.
The necessary objects are following :
a. A definition of a message CHANNEL (type=Sender)
- Channel name = QMC01.TO.QMC02
- Protocol = TCP/IP
- Network address = 'Host2(9002)'
- Transmission Queue name = name of the Remote QMGR
# runmqsc QMC01
DEF CHL(QMC01.TO.QMC02) CHLTYPE(SDR) REPLACE +
TRPTYPE(TCP) CONNAME('Host2(9002)') XMITQ(XQMC02)
Check => DISPLAY CHSTATUS(QMC01.TO.QMC02)
b. A definition of a message CHANNEL (type=Receiver)
The attribute should match to sender CHANNEL of the partner team.
# runmqsc QMC02
DEF CHL(QMC01.TO.QMC02) CHLTYPE(RCVR) REPLACE TRPTYPE(TCP)
ps : 原講義這邊寫 QMC02.TO.QMC01 是不對的,應該要一致才行。 囧rz
c. A Transmission Queue with the same name as the Remote Queue Manager (QMC02).
DEF QL(XQMC02) REPLACE USAGE(XMITQ)
d. A Dead Letter Queue named DLQ :
DEF QL(DLQ) REPLACE
e. Change the Queue Manager to use the Dead Letter Queue :
ALTER QMGR DEADQ(DLQ)
4. Use runmqsc to create the WebSphereMQ objects. (cont.)
[B. Configure and activate the required TCP Listener function.]
5. Start the Listener Listening on 9002.
# runmqlsr -m QMC02 -t TCP -p 9002
[C. Test and Start the connection.]
6. Ping the message CHANNEL from the sender end to test the CHANNEL definitions.
# runmqsc QMC01
PING CHL(QMC01.TO.QMC02)
( 成功的話, => AMQ8020: 連通測試 WebSphere MQ 通道完成。)
( 失敗的話, => AMQ9520: 通道沒在遠方定義。 )
7. Start the message CHANNEL using runmqchl and verify it it working.
# runmqchl -c QMC01.TO.QMC02 -m QMC01
[D. Create the required application objects.]
8. Define the application Queues on your Queue Manager :
a. ( on QMC02 ) Redefine the Local Queue QL.A :
DEF QL(QL.A) REPLACE
b. ( on QMC01 ) Create Local Definition of a Remote Queue for the QL.A on QMC02 :
DEF QR(QRMT02) REPLACE +
RNAME(QL.A) RQMNAME(QMC02) XMITQ(XQMC02)
9. Use runmqsc to create the WebSphereMQ objects. (cont.)
[E. Test distributed Queueing.]
10. Use amqsput to send messages to the Queue QL.A on the partner Queue Manager :
# amqsput QRMT02 QMC01
11. Use amqsget or amgsbcg to check for successful arrival of messages from your partner team.
# amqsget QL.A QMC02 or
# amqsbcg QL.A QMC02 or
check the CURDEPTH attribute of the target Queue.
→ ( on QMC02 ) DIS QL(QL.A) CURDEPTH
12. If the messages do not arrive, investigate the possible causes and solve the problem by :
- Local transmssion Queue is Empty ?
- Message CHANNEL is running ?
- Dead Letter Queue of target Queue Manager is Empty ?
- Inspect the error in both Queue Managers!
======================================================
[F'. Use Triggering in a distributed environment.]
Set up Remote Triggering :
Use the sample program amqsreq to send request messages to the Queue QL.A on the partner Queue Manager QMC02. The Target Queue should be enabled for triggering so that the sample program amqsech is started automatically in order to generate reply messages which are subsequently received by amqsreq.
1. Reactivate the Trigger function for QL.A to handle request messages send to
your QL.A now by the partner team.
DEFINE QLOCAL(QL.INITQ_AP) REPLACE
DEFINE PROCESS(PR.ECHO) REPLACE +
APPLICID('/mqmtop/samp/bin/amqsech') // UNIX Systems
DEFINE PROCESS(PR.ECHO) REPLACE +
APPLICID('amqsech') // Windows Systems
DEFINE QMODEL(QM.A_REPLY) REPLACE (這個在QMC01)
ALTER QL(QL.A) TRIGGER TRIGTYPE(FIRST)
INITQ(QL.INITQ_AP) PROCESS(PR.ECHO)
2. Restart the Trigger Monitor :
# runmqtrm -q QL.INITQ_AP -m QMC02
3. Put request messages on QL.A in your partner team Queue Manager.
# amqsreq QRMT02 QMC01 QM.A_REPLY
4. Check for a reply of each request message.
[G'. Use the CHANEL Initiator to start messages.]
5. Define and modify WebSphereMQ objects to setup automatic CHANNEL operation using a CHANNEL Initiator.
6. Define a CHANNEL Initiator Queue named QL.INITQ_CH :
DEF QL(QL.INITQ_CH)
7. Enable the Transmission Queue for Triggering :
ALTER QL(XQMC02) TRIGGER TRIGTYPE(FIRST) +
TRIGDATA(QMC01.TO.QMC02) INITQ(QL.INITQ_CH)
8. Set the disconnect interval of the CHANNEL to 30 seconds (default is 6000) :
ALTER CHL(QMC01.TO.QMC02) CHLTYPE(SDR) DISCINT(30)
9. Start the CHANNEL Initiator :
# runmqchi -m QMC01 -q QL.INITQ_CH
10. Stop and restart the Sender CHANNEL using runmqchi :
# STOP CHL(QMC01.TO.QMC02)
# runmqchl -m QMC01 -c QMC01.TO.QMC02
11. Wait until the CHANNEL is terminated by the DISCINT(30).
(The RUNMQCHL window will disappear after DISCINT(30) elapsed.)
If the WebSphereMQ Listener is used, you can also watch the Listener window
on the partners Queue Manager.
5724-H72 (C) Copyright IBM Corp. 1994, 2004. ALL RIGHTS RESERVED.
2008/1/15 15:20:47 通道 'QMC01.TO.QMC02' 正在啟動。
2008/1/15 15:21:18 切斷間隔過期。
2008/1/15 15:21:18 通道程式 'QMC01.TO.QMC02' 已正常終止。
12. Put some messages on the Queue QRMT02 using amqsput :
# amqsput QRMT02 QMC01
13. The CHANNEL should restart automatically.
14. If the WebSphereMQ Listener is used, you can also watch the Listener window
on the partner Queue Manager.
15. If the messages do not arrive, investigate the possible cause and solve the problem.
16. Put some messages on the Queue QRMT02 using amqsreq :
# amqsreq QRMT02 QMC01 QM.A_REPLY
17. Both CHANNELs should restart automatically.
18. Proof that by checking the CHANNEL status on both sides :
(Be sure that the DISCINT(30) has not elapsed. )
DIS CHS(QM.*) all
19. When using the WebSphereMQ Listener, you can also watch the Listener windows
on both Queue Managers.
20. If the messages do not arrive, investigate the possible cause and solve the problem.
沒有留言:
張貼留言