Fjli de blog分享 http://blog.sciencenet.cn/u/shipo Make or Break

博文

用 MQSC 脚本命令配置 MQ Manager

已有 9654 次阅读 2010-4-28 17:28 |个人分类:学习心得|系统分类:科研笔记| MQSC

之前是手动配置MQ管理器,今天学习写了个批处理脚本实现配置,方便快捷!

(1)配置文件

--------------------------
idsqmansetup.bat
--------------------------
echo create and start QMGR_IDS - IDS queue manager
echo.
crtmqm -c "IDS Queue Manager" -u SYSTEM.DEAD.LETTER.QUEUE QMGR_IDS
strmqm QMGR_IDS
echo.
idsqmanobjects
echo QMGR_IDS - IDS queue manager SETUP complete

----------------------------
idsqmanobjects.bat
----------------------------
echo run MQSC to add all ids mqmanager objects (queues and processes)
echo.
runmqsc QMGR_IDS < idsqmanmqsc.in > idsqmanmqsc.out
echo.

------------------------
idsqmanmqsc.in
------------------------
*******************************************************************
*** Define Application local queue (For Incoming Message)
*******************************************************************
*** LIncomingQueue is an Application queue which means that as well
***                as acting the same as standard local queues , it
***                also triggers a program using the Initiator queue
***                (LIniQueue see below) and the process defined in
***                the PROCESS parameter.
     
 
DEFINE QLOCAL (LIncomingQueue) +
*   Trigger control on
       TRIGGER +
*   Trigger on first message
       TRIGTYPE(FIRST) +
*   Trigger on first message                                         
       TRIGDPTH(1) +
*   Trigger on any priority
       TRIGMPRI(0) +
*   Trigger data
       TRIGDATA(' ') +
*   Process name to be called
       PROCESS('GetMsgProc') +
*   Initiation queue name
       INITQ('LIniQueue')
 
***********************************************************************
*** Define Initiator local queue
***********************************************************************
*** LIniQueue is an Initiator queue which accepts trigger messages
***           generated automatically by an Application queue,
***           in this case LIncomingQueue.                            
***           The messages on this queue are read by the runmqtrm
***           monitor (or a user written program if so desired)
***           It defaults to the attributes of SYSTEM.DEFAULT.LOCAL.QUEUE.
                
 
DEFINE QLOCAL(LIniQueue) LIKE ('SYSTEM.DEFAULT.INITIATION.QUEUE')
 
***********************************************************************
*** Define Process (Get Message)
***********************************************************************
*** GetMsgProc is a Process called by runmqtrm when it read a    
***            message on the Initiator queue (LIniQueue).       
***            The program defined by the APPLICID parameter
***            is called to read the message waiting on the      
***            Application queue (LIncomingQueue).
                      
 
DEFINE PROCESS('GetMsgProc') +
*   Process description
        DESCR('Get Message Process') +
*   Application type
        APPLTYPE(WINDOWSNT) +
*   Application identifier
        APPLICID('start /wait exmqrep3.exe LEXAQ3 EXQMAN') +
*   User data
        USERDATA(' ') +
*   Environment data
        ENVRDATA(' ')

*******************************************************************
*** Define Application remote queue (For Outgoing Message)
*******************************************************************
*** ROutgoingQueue is an Application queue which is acting as
***                standard remote queues. And it's name should be
***                identical to that of incoming queue(RNAME) on
***                remote MQ manager(RQMNAME).LTransferQueue is
***                local transfer queue.

DEFINE QREMOTE(ROutgoingQueue) +
*   Incoming queue on Remote MQ manager
       RNAME('ROutgoingQueue') +
*   remote MQMAN
       RQMNAME('MQ_APPLE') +
*   Transfer queue    
       XMITQ('LTransferQueue')

*******************************************************************
*** Define Application local transfer quque
*******************************************************************
*** LTransferQueue is an Application queue which is acting as
***                standard local queues but used for transfer.
***     And it trigger sender channel "IDS2OMO".

DEFINE QLOCAL(LTransferQueue) +
*   Use for transfer
       USAGE(XMITQ) +
*   Is persistant   
       DEFPSIST(YES) +
*   Trigger data
       TRIGDATA('IDS2OMO')  

*******************************************************************
*** Define Application sender channel
*******************************************************************
*** IDS2OMO is an sender channel for transfer messges from IDS to
***         OMO. It be trigged by transfer queue "LTransferQueue".

DEFINE CHANNEL(IDS2OMO)   +
*   Channel type   
       CHLTYPE(SDR)   +
*   Connect to OMO MQ Manager     
       CONNAME('192.77.107.109(1414)')   +
*   Transfer queue
       XMITQ('LTransferQueue')   +
*   TCP Type   
       TRPTYPE(TCP)  +
       REPLACE

*******************************************************************
*** Define Application receiver channel
*******************************************************************
*** IDS2OMO is an receiver channel for transfer messges from OMO to
***         IDS.

DEFINE CHANNEL(OMO2IDS)   +
*   Channel type
       CHLTYPE(RCVR)   +        
       REPLACE

*******************************************************************
*** Define dead queue
*******************************************************************
*** LDeadQueue is an dead queue which act as the same as standard
***            local queues. Especially, for the case that something
***        wrong when sending messages.

DEFINE QLOCAL(LDeadQueue) +
*  Is persistant
       DEFPSIST(YES) +
    REPLACE

*  Alart MQ manager purpertity
ALTER QMGR DEADQ('LDeadQueue')

*******************************************************************
*** Define listener
*******************************************************************
*** Listener.TCP.IDS is an listener which listens IDS message system.
***                  TCP protocol with 1416 port

DEFINE LISTENER(Listener.TCP.IDS) TRPTYPE(TCP) PORT(1416)

START LISTENER(Listener.TCP.IDS)

 

(2)启动MQ管理器和Trigger Monitor
-----------------------------------
idsqmanstartservice.bat
-----------------------------------
echo run MQSC to start MQ services (Qmgr, trigger monitor, listener)
echo.
strmqm QMGR_IDS
runmqtrm -m QMGR_IDS -q LIniQueue
echo.

 

(3)运行idsqmansetup.bat结果:
--------------------------
idsqmanmqsc.out
--------------------------
5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.
启动队列管理器 QMGR_IDS 的 MQSC。


       : *******************************************************************
       : *** Define Application local queue (For Incoming Message)
       : *******************************************************************
       : *** LIncomingQueue is an Application queue which means that as well
       : ***                as acting the same as standard local queues , it
       : ***                also triggers a program using the Initiator queue
       : ***                (LIniQueue see below) and the process defined in
       : ***                the PROCESS parameter.     
       : 
     1 : DEFINE QLOCAL (LIncomingQueue) +
       : *   Trigger control on
       :        TRIGGER +
       : *   Trigger on first message
       :        TRIGTYPE(FIRST) +
       : *   Trigger on first message                                         
       :        TRIGDPTH(1) +
       : *   Trigger on any priority
       :        TRIGMPRI(0) +
       : *   Trigger data
       :        TRIGDATA(' ') +
       : *   Process name to be called
       :        PROCESS('GetMsgProc') +
       : *   Initiation queue name
       :        INITQ('LIniQueue')
AMQ8006: WebSphere MQ 队列已创建。
       : 
       : ***********************************************************************
       : *** Define Initiator local queue
       : ***********************************************************************
       : *** LIniQueue is an Initiator queue which accepts trigger messages
       : ***           generated automatically by an Application queue,
       : ***           in this case LIncomingQueue.                            
       : ***           The messages on this queue are read by the runmqtrm
       : ***           monitor (or a user written program if so desired)
       : ***           It defaults to the attributes of SYSTEM.DEFAULT.LOCAL.QUEUE.                
       : 
     2 : DEFINE QLOCAL (LIniQueue)
AMQ8006: WebSphere MQ 队列已创建。
       : 
       : ***********************************************************************
       : *** Define Process (Get Message)
       : ***********************************************************************
       : *** GetMsgProc is a Process called by runmqtrm when it read a    
       : ***            message on the Initiator queue (LIniQueue).       
       : ***            The program defined by the APPLICID parameter
       : ***            is called to read the message waiting on the      
       : ***            Application queue (LIncomingQueue).                      
       : 
     3 : DEFINE PROCESS('GetMsgProc') +
       : *   Process description
       :         DESCR('Get Message Process') +
       : *   Application type
       :         APPLTYPE(WINDOWSNT) +
       : *   Application identifier
       :         APPLICID('start /wait exmqrep3.exe LEXAQ3 EXQMAN') +
       : *   User data
       :         USERDATA(' ') +
       : *   Environment data
       :         ENVRDATA(' ')
AMQ8010: WebSphere MQ 进程已创建。
       :
       : *******************************************************************
       : *** Define Application remote queue (For Outgoing Message)
       : *******************************************************************
       : *** ROutgoingQueue is an Application queue which is acting as
       : ***                standard remote queues. And it's name should be
       : ***     identical to that of incoming queue(RNAME) on
       : ***     remote MQ manager(RQMNAME).LTransferQueue is
       : ***     local transfer queue.
       :
     4 : DEFINE QREMOTE(ROutgoingQueue) +
       : *   Incoming queue on Remote MQ manager
       :        RNAME('ROutgoingQueue') +
       : *   remote MQMAN
       :        RQMNAME('MQ_APPLE') +
       : *   Transfer queue    
       :        XMITQ('LTransferQueue')
AMQ8006: WebSphere MQ 队列已创建。
       :
       : *******************************************************************
       : *** Define Application local transfer quque
       : *******************************************************************
       : *** LTransferQueue is an Application queue which is acting as
       : ***                standard local queues but used for transfer.
       : ***     And it trigger sender channel "IDS2OMO".
       :
     5 : DEFINE QLOCAL(LTransferQueue) +
       : *   Use for transfer
       :        USAGE(XMITQ) +
       : *   Is persistant   
       :        DEFPSIST(YES) +
       : *   Trigger data
       :        TRIGDATA('IDS2OMO')  
AMQ8006: WebSphere MQ 队列已创建。
       :
       : *******************************************************************
       : *** Define Application sender channel
       : *******************************************************************
       : *** IDS2OMO is an sender channel for transfer messges from IDS to
       : ***         OMO. It be trigged by transfer queue "LTransferQueue".
       :
     6 : DEFINE CHANNEL(IDS2OMO)   +
       : *   Channel type   
       :        CHLTYPE(SDR)   +
       : *   Connect to OMO MQ Manager     
       :        CONNAME('192.77.107.109(1414)')   +
       : *   Transfer queue
       :        XMITQ('LTransferQueue')   +
       : *   TCP Type   
       :        TRPTYPE(TCP)  +
       :        REPLACE
AMQ8014: WebSphere MQ 通道已创建。
       :
       : *******************************************************************
       : *** Define Application receiver channel
       : *******************************************************************
       : *** IDS2OMO is an receiver channel for transfer messges from OMO to
       : ***         IDS.
       :
     7 : DEFINE CHANNEL(OMO2IDS)   +
       : *   Channel type
       :        CHLTYPE(RCVR)   +        
       :        REPLACE
AMQ8014: WebSphere MQ 通道已创建。
       :
       : *******************************************************************
       : *** Define dead queue
       : *******************************************************************
       : *** LDeadQueue is an dead queue which act as the same as standard
       : ***            local queues. Especially, for the case that something
       : ***        wrong when sending messages.
       :
     8 : DEFINE QLOCAL(LDeadQueue) +
       : *  Is persistant
       :        DEFPSIST(YES) +
       :     REPLACE
AMQ8006: WebSphere MQ 队列已创建。
       :
       : *  Alart MQ manager purpertity
     9 : ALTER QMGR DEADQ('LDeadQueue')
AMQ8005: WebSphere MQ 队列管理器已更改。
       :
       : *******************************************************************
       : *** Define listener
       : *******************************************************************
       : *** Listener.TCP.IDS is an listener which listens IDS message system.
       : ***                  TCP protocol with 1416 port
       :
    10 : DEFINE LISTENER(Listener.TCP.IDS) TRPTYPE(TCP) PORT(1416)
AMQ8626: WebSphere MQ 侦听器已创建。
       :
    11 : START LISTENER(Listener.TCP.IDS)
AMQ8021: 已接受启动 WebSphere MQ 侦听器的请求。
已读取 11 个 MQSC 命令。
所有命令均无语法错误。
已处理所有的有效 MQSC 命令。

 

这里值得一提的是定义Initial Queue时要用:

DEFINE QLOCAL(LIniQueue) LIKE ('SYSTEM.DEFAULT.INITIATION.QUEUE')



https://blog.sciencenet.cn/blog-427149-317169.html

上一篇:PCI将多个波段图像变成一个多波段图像操作
下一篇:按图索骥——新街口豁口外的那些河儿
收藏 IP: .*| 热度|

0

发表评论 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-11-29 00:52

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部