.
. IBM WebSphere MQ v6.0
. Ex2 - Implementing MQ Trigger
. 讓我們來練習一下如何 Implementing MQ 的Trigger
.
====== Exercise 2. Implementing Trigger ======
1. Create an Initiation Queue named QL.INITQ_AP :
# runmqsc QMC00A (QMC00A is your Queue Manager)
DEFINE QLOCAL(QL.INITQ_AP) REPLACE
2. Create a Local Queue (named QL.QT1) which is enabled for Triggering :
DEFINE QL(QL.QT1) REPLACE +
TRIGGER +
TRIGTYPE(FIRST) +
PROCESS(PR.ECHO) +
INITQ(QL.INITQ_AP)
3. Create a PROCESS (named PR.ECHO) to identify the application to be started. In such a way that amqsech is started synchronously with respect to the execution of the Trigger Monitor.
DEFINE PROCESS(PR.ECHO) REPLACE +
APPLICID('/mqmtop/samp/bin/amqsech') // UNIX Systems
DEFINE PROCESS(PR.ECHO) REPLACE +
APPLICID('amqsech') // Windows Systems
4. Use a Dynamic TEMP Queue (named QM.QT1_REPLY) as Reply-to-Queue which is created by a Model Queue :
DEFINE QMODEL(QM.QT1_REPLY) REPLACE
5. Start the Trigger Monitor using the control command runmqtrm . Name the Initiation Queue.
# runmqtrm -m QMC00A -q QL.INITQ_AP
5724-H72 (C) Copyright IBM Corp. 1994, 2004. ALL RIGHTS RESERVED.
WebSphere MQ 觸發監視器已啟動。
__________________________________________________
請等待觸發訊息。
====== Exercise 2.a Test Triggering with amqsinq ======
6. Test Triggering :
# amqsreq QL.QT1 QMC00A QM.QT1_REPLY
(打一些字然後按 Enter,會在 Trigger Monitor 視窗)
7. 把 QL(QL.QT1) 設成 TRIGTYPE(EVERY) 再試試看:
DEFINE QL(QL.QT1) REPLACE +
TRIGGER +
TRIGTYPE(EVERY) +
PROCESS(PR.ECHO) +
INITQ(QL.INITQ_AP)
8. 把 QL(QL.QT1) 設成 TRIGTYPE(DEPTH) 再試試看:
DEFINE QL(QL.QT1) REPLACE +
TRIGGER +
TRIGTYPE(DEPTH) TRIGDPTH(6) +
PROCESS(PR.ECHO) +
INITQ(QL.INITQ_AP)
====== Exercise 2.b Test Triggering with amqsinq ======
9. Create a 2nd PROCESS object for amqsinq :
DEFINE PROCESS(PR.INQ) REPLACE +
APPLICID('/mqmtop/samp/bin/amqsinq') // UNIX Systems
DEFINE PROCESS(PR.INQ) REPLACE +
APPLICID('amqsinq') // Windows Systems
10. ALTER the QL(QL.QT1) appropriately :
ALTER QL(QL.QT1) PROCESS(PR.INQ)
11. Run amqsreq again, remembering that amqsinq now expects the application data in each message to contain the name of a Queue. For example, use the names of the following Queues :
# amqsreq QL.QT1 QMC00A QM.QT1_REPLY
SYSTEM.ADMIN.COMMAND.QUEUE
QM.QT1_REPLY
SYSTEM.SAMPLE.REPLY
QL.QT1
=> Try an invalid Queue name.
===============================
====== 補充:Channel Trigger ======
===============================
※ 不需要 Trigger Monitor,也不需要 Data ,亦可以避免 Channel Expire 的暫停。
[QM1] (Listen : 1414)
XXX.QR →→→ YYY.QL
QM2.XMITQ ---Trigger
---> SYSTEM.CHANNEL.INITQ
---> QM1.To.QM2 (SDR)
[QM2] (Listen : 1415)
YYY.QL
QM1.To.QM2 (RCVR)
ALTER XMITQ
TRIGGER Control ON
TRIGGER TYPE FIRST
TRIGGER DATA(Channel Name)
INITIATION QUEUE
SYSTEM.CHANNEL.INITQ
沒有留言:
張貼留言