close

2007年12月8日 星期六

.
. IBM WebSphere MQ v6.0
. Chapter 2.2 - IBM WebSphere MQ6指令與MQSC
.


※ 一般小寫是 Control Command /// 一般大寫是 MQSC (runmqsc

------DEFINE指令:定義新的Queue物件------
# runmqsc QMC00A
1. DEFINE QLOCAL(QL.Q1) REPLACE
 (與指令 DEF QL(QL.Q1) REPLACE 相同,可用 DIS QL(QL.Q1) 察看 )
 例如 : DEF QL(QL.Q1)

2. DEF QL(QL.Q1tmp) LIKE (QL.Q1)

 例如 : DEF QL(QL.Q1tmp) LIKE (QL.Q1)

3. DEF QL(QL.Q2) REPLACE DESCR('描述字串')
 例如 : DEF QL(QL.Q2) REPLACE DESCR('This is a test queue2')

※ 用 (+) 號:表示連結,V5之前一行不超過80字元,V5之後無限制.
※ 用 (;) 號:表示結尾.
※ REPLACE:表示如果存在就替換,不存在就建立.
※ LIKE:建立一個 Queue 套用指定的 attributes.

4. DEFINE QLOCAL(QL.Q3) REPLACE +
  DESCR('This is a test queue3') +
  PUT(ENABLED) GET(ENABLED) +
  DEFPSIST(YES) SHARE +
  MAXDEPTH(1000) MAXMSGL(2000) +
  NPMCLASS(HIGH)
※ 系統Default Local Queue 屬性:default is SYSTEM.DEFAULT.LOCAL.QUEUE
※ MAXDEPTH : 最大深度
※ MAXMSGL : 最大 Message Length
NPMCLASS : allows the survival of nonpersistent messages.
 The allowed settings are HIGH(可能遺失MSG) and NORMAL.
 The NPMCLASS can be defined or altered on Local and Model.

------DISPLAY指令:顯示物件------
# runmqsc QMC00A
1. DISPLAY QMGR ALL (顯示目前 QMGR的屬性, 指令 DIS QMGR 相同)


2. DISPLAY QUEUE(*) (顯示所有的 QUEUE, 指令 DIS Q(*) 相同)

3. DISPLAY Q(SYSTEM*) ( * 只能放在尾巴)

4. DIS Q(QL.Q1) ALL (顯示 Q1.QL 的所有屬性)

5. DIS Q(QL.Q1) DESCR GET PUT

6. DIS Q(QL.Q1) MAXDEPTH CURDEPTH (查詢 Q1.QL 最大深度 與 現在深度 )

7. DIS QLOCAL(*) (顯示所有的 LOCAL QUEUE)
 DIS QALIAS(*)
 DIS QMODEL(*)
 DIS QREMOTE(*)


------DEFINE指令2:定義其他Queue物件------
1. DEFINE QALIAS(QA.Q1) TARGQ(QL.Q1)

2. DEFINE QREMOTE(QR.Q1) RNAME(QL.Q1) RQMNAME(QMC00B)

3. DEFINE QMODEL(ANSQ) DEFTYPE(TEMPDYN)
※Model Queue :
 - TEMPDYN, dynamic queue deleted when closed.
 - PERMDYN, dynamic queue may hold persistent messages.

※ 可以測試看看 ALIAS Queue 與實際 Queue 有什麼差別?
範例:DEF QL(QL.Q4) REPLACE
範例:DEF QA(QA.Q4) TARGQ(QL.Q5) REPLACE
範例:ALTER QA(QA.Q4) PUT(DISABLED)
範例:DIS QL(QL.Q4) PUT CURDEPTH
範例:試著在Command Line : amqsput QL.Q4 QMC00A (可塞)
範例:試著在Command Line : amqsput QA.Q4 QMC00A (不可塞)
(MQPUT ended with reason code 2051 , 表示QA.Q4無法塞入,但QL.Q4可以)


範例:DEF QL(QL.Q5) REPLACE
範例:DEF QA(QA.Q5) TARGQ(QL.Q5) REPLACE
範例:ALTER QL(QL.Q5) PUT(DISABLED)
範例:DIS QL(QL.Q5) PUT CURDEPTH
範例:試著在Command Line : amqsput QL.Q5 QMC00A (不可塞)
範例:試著在Command Line : amqsput QA.Q5 QMC00A (不可塞)
(MQPUT ended with reason code 2051 , 表示皆無法塞入)


------ALTER指令:修改新的物件------
1. ALTER QLOCAL(QL.Q1) MAXDEPTH(8888)

2. ALTER QLOCAL(QL.Q1) PUT(DISABLED)

3. ALTER QALIAS(QA.Q1) TARQ(QL.Q1tmp)

4. ALTER QMGR DESCR('New description')


------DELETE指令:刪除物件------
1. DELETE QLOCAL(QL.Q1) (注意:只有在 Queue 沒用時才可以用)

2. DEL QL(QL.Q1) PURGE (強制刪除 Queue )

3. DELETE QREMOTE(QR.Q1)


------DELETE all messages on the Local Queue------
1. CLEAR QLOCAL(QL.Q1) (不是 In Use 才能清空QL,另一方式是用TOOL去GET掉)
 例如 : CLEAR QL(QL.Q5) (=> AMQ8022: 已清除 WebSphere MQ 佇列。)


------關於DEAD LETTER QUEUE------
1. DEFINE QLOCAL(DLQ) REPLACE (與 DEF QL(DLQ) REPLACE 指令相同)

2. ALTER QMGR DEADQ(DLQ) (指定 DLQ 為 QM 的 DEAD LETTER QUEUE)


------結束runmqsc------
※ Windows : Ctrl+Z (END)
※ UNIX / Linux : Ctrl+D (END)


 

======Sample Programs======
# amqsput QName [QMgrName] (把Message放到QMgrName QName

, EOF結束) (The program connects to the Queue Manager and opens the Queue for output, reads lines of text form the standard input device, generates a message from each line of text and puts the messages on the named queue. After reading a null line or EOF character from the standard input device, it close the Queue, and disconnects from the Queue Manager)

 例如:# amqsput QL.Q1 QMC00A
 (塞完之後可以在 runmqsc 用 DISPLAY QL(QL.Q1) CURDEPTH 看結果)


# amqsget QName [QMgrName] (把Message從到QName取出)
(The program connects to the Queue Manager, opens the Queue for input, gets all the messages from the Queue, write the text within the message to the standard output device, waits 15 seconds in case any more messages are put on the Queue and, if none arrive, closes the Queue and disconnects from the Queue manager)
(※※※ 但注意 amqsget 的 get buffer只有100bytes)
 例如:# amqsget QL.Q1 QMC00A > QLQ1.msg


# amqsbcg QName [QMgrName]

(Display messages, including message descriptors) (The program connects to the Queue Manager, opens the Queue for browsing, browses all the messages on the Queue, and writes their contents, in both hex and character format, to the standard output device. It also displays, in a readable format, the fields in the message descriptor for each message. It then closes the Queue and disconnects from the Queue Manager)


arrow
arrow
    全站熱搜

    amzshar 發表在 痞客邦 留言(0) 人氣()