Controlling trigger events
You control trigger events using some of the attributes that define your application queue. We can enable and disable triggering, and we can select the number or priority of the messages that count toward a trigger event. There is a full description of these attributes in the Application Programming Reference.
The relevant attributes are:
- TriggerControl
- Use this attribute to enable and disable triggering for an application queue.
- TriggerMsgPriority
- The minimum priority that a message must have for it to count toward a trigger event. If a message of priority less than TriggerMsgPriority arrives on the application queue, the queue manager ignores the message when it determines whether to create a trigger message. If TriggerMsgPriority is set to zero, all messages count toward a trigger event.
- TriggerType
- In addition to the trigger type NONE (which disables triggering just like setting the TriggerControl to OFF), we can use the following trigger types to set the sensitivity of a queue to trigger events:
EVERY A trigger event occurs every time that a message arrives on the application queue. Use this type of trigger if you want a serving program to process only one message, then end. FIRST A trigger event occurs only when the number of messages on the application queue changes from zero to one. Use this type of trigger if you want a serving program to start when the first message arrives on a queue, continue until there are no more messages to process, then end. Also see Special case of trigger type FIRST. DEPTH A trigger event occurs only when the number of messages on the application queue reaches the value of the TriggerDepth attribute. A typical use of this type of triggering is to start a program when all the replies to a set of requests are received. Triggering by depth: With triggering by depth, the queue manager disables triggering (using the <xph><pv>TriggerControl</pv></xph> attribute) after it creates a trigger message. Your application must re-enable triggering itself (by using the MQSET call) after this has happened.The action of disabling triggering is not under syncpoint control, so triggering cannot be re-enabled simply by backing out a unit of work. If a program backs out a put request that caused a trigger event, or if the program abends, re-enable triggering by using the MQSET call or the ALTER QLOCAL command.
- TriggerDepth
- The number of messages on a queue that causes a trigger event when using triggering by depth.
The conditions that must be satisfied for a queue manager to create a trigger message are described in Conditions for a trigger event.
- Example of the use of trigger type EVERY
- Example of the use of trigger type FIRST
- Example of the use of trigger type DEPTH
- Special case of trigger type FIRST
Parent topic:
Starting WebSphere MQ applications using triggers
fg13870_