Professional Documents
Culture Documents
WebSphere MQ Triggering
Agenda
What is triggering How does triggering work The flow of triggering The different types of triggering How to set up triggering The conditions for a trigger event How to diagnose triggering problems Miscellaneous notes Triggering Documentation and SupportPacs
2 of 37
Acknowledgement
Special thanks to Calista Stevens for her contribution to the content of this presentation.
3 of 37
4 of 37
5 of 37
Flow of Triggering
Queue Manager Xmitq or Localq
Local or MCA
3.Trigger Message Retrieved Program Trigger monitor 4. Start User Program or RUNMQCHL
6 of 37
TRIGTYPE
FIRST: A trigger event occurs when the current depth of the triggered queue changes from 0 to 1. Use this type of trigger when the serving program will process all the messages on the queue (i.e. until MQRC_NO_MSG_AVAILABLE). EVERY: A trigger event occurs every time a message arrives on the triggered queue. Use this type of trigger when the serving program will only process one message at a time. Note: On i5/OS this value is *ALL.
7 of 37
TRIGTYPE
DEPTH: A trigger event occurs when the number of messages on the triggered queue reaches the value of the TRIGDPTH attribute. Use this type of trigger when the serving program is designed to process a fixed number of messages (i.e. all replies for a certain request). Note: When triggering by depth, triggering is disabled and must be re-enabled by using MQSET or ALTER QLOCAL.
8 of 37
Trigger Interval
TriggerInterval or TRIGINT is a time interval specified on the QMGR definition for use by queues defined as TRIGTYPE=FIRST. Situations may occur when messages are left on the queue. New messages will not cause another trigger message. To help with this situation, a trigger message will be created when the next message is put if TriggerInterval has elapsed since the last trigger message was created for the queue. z/OS has a backstop process to scan queues.
9 of 37
10 of 37
11 of 37
12 of 37
14 of 37
15 of 37
17 of 37
18 of 37
Trigger conditions
A trigger message is sent to the initiation queue when all of the following conditions are satisfied: 1. A message is put on a transmission or local queue. 2. The messages priority is greater than or equal to the TriggerMsgPriority of the queue.
19 of 37
Trigger conditions
3. The number of messages on queue was previously - Zero for trigger type FIRST - Any number for trigger type EVERY or *ALL - TriggerDepth minus 1 for trigger type DEPTH 4. For trigger type FIRST or DEPTH, no program has the trigger queue open for GETs (Open input count=0). 5. The Get enabled attribute is set to YES on the triggered queue.
20 of 37
Trigger conditions
6. A Process name is specified and exists, or for transmission queues, TriggerData contains the name of a channel. 7. An Initiation queue is specified and exists and GETs and PUTs are enabled for the initiation queue. 8. The trigger monitor has been started and has the initiation queue open for GETs
21 of 37
Trigger conditions
9. The TriggerControl attribute is set to YES on the triggered queue. 10. The TriggerType attribute is not set to NONE. 11. For Trigger Type FIRST, the queue was not previously empty, but the TriggerInterval set for the QMGR has elapsed. 12. The only application serving the queue issues MQCLOSE and there are still messages on the queue that satisfy Conditions 2 and 6-10.
22 of 37
Trigger conditions
13. Certain trigger attributes of the triggered queue are changed, such as - NOTRIGGER to TRIGGER - PUT or GET DISABLED to ENABLED or a trigger monitor opens the Initiation queue. 14. MSGDLVSQ is set correctly relative to the priority of the messages and the TriggerMsgPriority setting.
23 of 37
Problem Determination
If the setup is brand new or any configuration changes have been made, verify all the definitions are complete and correct. If the setup is brand new or has worked before, verify all the conditions for a trigger event are satisfied. If channel triggering, verify the correct channel name is specified and the channel is not in a STOPPED state.
24 of 37
Problem Determination
If application triggering - verify the application name is correct and exists - verify the application is coded correctly - verify the correct authorizations are in place. Verify a trigger message can be delivered. Verify a trigger monitor is active. Verify trigger type and application design match. Try manually starting the triggered application to see if it is able to run.
25 of 37
Problem Determination
Stranded messages may occur when the triggered application fails to remove one or more messages - for TriggerType FIRST, use TriggerInteval as a safety net, because a trigger event only occurs when depth goes from 0 to 1. - for TriggerType EVERY, if the triggered application only does one MQGET, manual intervention will be required to process the messages. Otherwise, the application will only read the oldest message on the next successful trigger and the queue depth will remain non-zero.
WebSphere Support Technical Exchange 26 of 37
Problem Determination
If there is a loop or high CPU: - Change the triggered application to specify a WaitInterval on its MQGET. Remember Condition 12 and see Getting messages from a triggered queue:
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/ com.ibm.mq.csqzal.doc/fg13940_.htm - Check the
Run a trace.
WebSphere Support Technical Exchange 27 of 37
Notes:
For trigger EVERY, if the trigger monitor ends prematurely, no matter how many messages reside on the queue only one trigger message will be created on restart. RUNMQTRM will not get another trigger message until the application completes. To prevent trigger messages from accumulating - Run multiple trigger monitors or - Run the applications in the background
28 of 37
Notes:
A trigger message is put to the dead letter queue when - The queue manager can not put a trigger message on the INITQ - RUNMQTRM detects an error in the trigger message structure - RUNMQTRM detects an unsupported application type - RUNMQTRM can not start the application - RUNMQTRM detects a data conversion error
29 of 37
Notes:
Trigger messages are non-persistent. Conditions for a trigger event are persistent, so, if a trigger message is lost a trigger message will be created when the conditions are met. Trigger messages take on the default priority of the INITQ. Trigger monitors can not retrieve messages that are part of a unit of work until the unit of work completes (applies whether it is committed or backed out).
30 of 37
Notes:
The queue manager counts both committed and uncommitted messages on the trigger queue when assessing the conditions for a trigger event. The exception is that only committed messages cause a trigger event for shared queues (on a Coupling Facility) on z/OS. After recycling the queue manager or trigger monitor, a trigger message may be created if the triggered queue has messages on it and provided the trigger conditions are met.
31 of 37
Notes:
When triggering channels, trigger type FIRST or DEPTH is recommended. Disabling triggering is not under syncpoint control so triggering can not be re-enabled by backing out a unit of work. If a program backs out a unit of work or abends, triggering for DEPTH must be reenabled by MQSET, ALTER or CHGMQMQ. On z/OS, the CICS trigger monitor autoreconnects after the queue manager terminates.
32 of 37
Link to manuals:
http://www-01.ibm.com/software/integration/wmq/library/
MQ SupportPacs:
http://www-01.ibm.com/support/docview.wss? uid=swg27007197
WebSphere Support Technical Exchange 33 of 37
Summary
What is triggering and how does it work How to set up triggering The conditions for a trigger event Problem determination for triggering problems
34 of 37
35 of 37
Or go to https://www.ibm.com/survey/oid/wsb.dll/s/ag21f?wsb34=swg_user
36 of 37
37 of 37