Monday, April 12, 2010

Triggering in MQ v6

1. Define a local queue by name TESTTRIG under the Queue Manager QM.ROH as follows:

DEFINE QLOCAL('TESTTRIG') DESCR('To test how the property trigger works')

1 : DEFINE QLOCAL('TESTTRIG') DEFPSIST(YES) DESCR('To test how the propert
y trigger works')
AMQ8006: WebSphere MQ queue created.



2. Create a process that needs to be invoked with the trigger.

DEFINE PROCESS(process_name)
[ APPLICID(string) ]
[ APPLTYPE( CICS | DEF | DOS | OS2 | UNIX | WINDOWS | WINDOWSNT |
NOTESAGENT | OS400 | integer) ]
[ DESCR(string) ]
[ ENVRDATA(string) ]
[ LIKE(process_name) ]
[ REPLACE | NOREPLACE ]
[ USERDATA(string) ]


Example:


DEFINE PROCESS('IE') DESCR('Internet explorer') APPLTYPE(WINDOWS) APPLICID('iexplore')
5 : DEFINE PROCESS('IE') DESCR('Internet explorer') APPLTYPE(WINDOWS) APPLI
CID('iexplore')
AMQ8010: WebSphere MQ process created.



DISPLAY PROCESS('IE')

6 : DISPLAY PROCESS('IE')
AMQ8407: Display Process details.
PROCESS(IE) APPLTYPE(WINDOWS)
APPLICID('iexplore')
ENVRDATA( ) USERDATA( )
DESCR(Internet explorer) ALTDATE(2010-04-12)

ALTTIME(14.09.48)




3. Created a Queue to use as an Initiation queue

DEFINE QLOCAL('trig.initq') descr('initiation queue for triggering ie')
5 : DEFINE QLOCAL('trig.initq') descr('initiation queue for triggering ie')

AMQ8006: WebSphere MQ queue created.

Enable triggering on hosting a queue "TESTTRIG"




4. ALTER QLOCAL('TESTTRIG') TRIGGER TRIGTYPE(FIRST) INITQ('trig.initq') PROCESS('IE')
6 : ALTER QLOCAL('TESTTRIG') TRIGGER TRIGTYPE(FIRST) INITQ('trig.initq') PR
OCESS('IE')
AMQ8008: WebSphere MQ queue changed.

DISPLAY QLOCAL('TESTTRIG')




5. The most important part is to START the MQ TRIGGER MONITOR and let this trigger monitor run till you need the queue to trigger the application.


C:\IBMWMQ\WebSphereMQ\bin>runmqtrm -m QM.ROH -q trig.initq
5724-H72 (C) Copyright IBM Corp. 1994, 2004. ALL RIGHTS RESERVED.
WebSphere MQ trigger monitor started.

__________________________________________________
Waiting for a trigger message




6. Now start putting the messages in the queue TESTTRIG and notice that with every first occurence of the message in the queue manager QM.ROH, the internet explorer application opens up.





No comments:

Post a Comment