Every Trigger

TRIGTYPE(EVERY)—every trigger—tells IBM MQ to treat each message arrival as a potential signal to start application processing through the trigger monitor. Where FIRST rings the doorbell once when mail first appears in an empty box, EVERY rings for every letter. That sounds precise but on a busy queue it becomes a process factory: hundreds of shell scripts or Java VMs launching per minute, initiation queue depth spiking, and operators paging on CPU while messages still backlog. This tutorial explains how EVERY works, when enterprises still use it, how the trigger monitor interacts with PROCESS definitions, coalescing and practical limits, safer alternatives, and troubleshooting when EVERY was chosen years ago and volume has grown.

How EVERY Triggering Works

A queue with TRIGGER(YES), TRIGTYPE(EVERY), PROCESS(name), and INITQ(name) causes the queue manager to write trigger messages to the initiation queue when puts satisfy the every-message rule. The trigger monitor reads each trigger message and starts APPLICID from the PROCESS object—often a script or binary path on distributed MQ, or a transaction on z/OS. The started program is expected to open the application queue, process work, and exit. If each instance handles only one message and exits, EVERY aligns with that design. If startup cost is seconds, EVERY cannot keep pace with sub-second put rates.

EVERY vs FIRST vs DEPTH at a glance
TRIGTYPETypical fire patternHigh-volume risk
FIRST0 → 1 depth transitionLow if consumer drains queue
EVERYEach put (per rules)High—process storm
DEPTHCURDEPTH >= TRIGDPTHMedium—tune threshold

Defining EVERY Trigger

shell
1
2
3
4
5
DEFINE QLOCAL('LOWVOL.IN') TRIGGER(YES) TRIGTYPE(EVERY) + PROCESS('HANDLE.ONE') INITQ('SYSTEM.DEFAULT.INITIATION.QUEUE') + TRIGDATA('MODE=SINGLE') DEFINE PROCESS('HANDLE.ONE') APPLICID('/opt/handle_one.sh') APPLTYPE(UNIX) * Script should MQGET one message, process, commit, exit

TRIGDATA passes context to the started program—queue name, business parameters, or a flag that the worker should process exactly one message. USERDATA on PROCESS can duplicate environment hints. Wrong APPLICID leaves messages on LOWVOL.IN while initiation queue grows—check AMQERR for trigger monitor errors identical to other trigger types.

Process Storms and Resource Limits

Operating systems cap processes per user and file descriptors per process. MQ trigger monitor starting hundreds of children can hit ulimit -u, fill /tmp, or saturate disk with logs. Initiation queue depth may lag if the monitor cannot start fast enough—trigger messages accumulate, delaying all triggered queues sharing that INITQ. Monitoring INITQ depth is mandatory for EVERY estates. Rate limiting at the application put side is not a substitute for changing TRIGTYPE.

When EVERY Still Makes Sense

  • Low message rate—fewer than one message per minute with heavy per-message isolation requirements.
  • Legacy executable that cannot loop—vendor binary processes one file per invocation.
  • Lab and education—demonstrating trigger monitor behavior message by message.
  • Bridge to non-MQ systems that spawn once per notification.

Even in these cases, document maximum sustainable rate and escalation when rate exceeds design.

Migrating Away From EVERY

  1. Measure peak puts per second and average process start time.
  2. Implement consumer that loops MQGET until empty (syncpoint per business rules).
  3. Change TRIGTYPE to FIRST; verify empty-queue behavior with operations.
  4. Load test; add DEPTH if parallel workers needed at backlog thresholds.
  5. Decommission per-message scripts gradually with rollback plan.

Explainer: Doorbell Every Single Package

EVERY is ringing the doorbell for every package delivered. If packages arrive every second, nobody can answer the door fast enough and packages pile on the porch—the initiation queue—while exhausted helpers collapse from running to the door.

Explain Like I'm Five: Every Trigger

Every time a toy is put in the box, you yell for a new friend to come play. If toys arrive faster than friends can run over, the yard fills with yelling and confused friends, and toys still sit in the box.

Practice Exercises

Exercise 1

Lab: EVERY with 20 rapid puts—observe INITQ depth and OS process count.

Exercise 2

Rewrite same queue as FIRST with loop-until-empty script; compare resource use.

Exercise 3

Write approval criteria: when EVERY is allowed in your standards document.

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. TRIGTYPE EVERY fires:

  • Per message put pattern
  • Only when queue empty
  • On channel start
  • On TLS only

2. EVERY at high volume risks:

  • Process storm
  • Lower CURDEPTH
  • Automatic DLQ delete
  • No INITQ needed

3. Better high-volume pattern often is:

  • FIRST or long-running consumer
  • EVERY always
  • No TRIGGER
  • DELETE QMGR

4. Trigger messages go to:

  • Initiation queue
  • XMITQ
  • Topic
  • AMQERR
Published
Read time17 min
AuthorMainframeMaster
Verified: IBM MQ 9.3 documentation