Depth Trigger

Depth trigger—TRIGTYPE(DEPTH)—is IBM MQ's way of saying "call more help when the pile is big enough." When CURDEPTH on a triggered queue reaches TRIGDPTH, the queue manager can write a trigger message so the trigger monitor starts another consumer instance. Payment systems use depth triggers after Black Friday traffic exceeds single-threaded processing; batch warehouses use them when file drops spike overnight. Misconfigured TRIGDPTH causes flapping triggers at the boundary or no extra workers when backlog is obvious. This tutorial explains TRIGDPTH selection, how depth triggers interact with FIRST and long-running consumers, PROCESS and INITQ requirements, sizing math, monitoring, and troubleshooting when depth is high but no new workers appear.

TRIGTYPE(DEPTH) Behavior

Unlike FIRST, depth trigger does not require the queue to have been empty. A steady stream of puts can push CURDEPTH from 400 to 600; if TRIGDPTH is 500, crossing that threshold generates trigger activity per queue manager rules. The started application should drain messages until depth falls or until a business limit stops the worker. If workers exit while depth remains above TRIGDPTH, another depth trigger may fire—by design for scale-out, dangerous if unchecked.

Tuning TRIGDPTH (starting points—validate in load test)
FactorGuidanceRationale
Processing time per messageHigher latency → lower TRIGDPTHBacklog builds faster per worker
Target parallel workersTRIGDPTH ≈ backlog per worker desiredAvoid starting 50 processes at once
Put burst rateSet above normal idle depthPrevent flapping on routine traffic
MAXDEPTHTRIGDPTH well below MAXDEPTHRoom before queue full 2053

MQSC Example

shell
1
2
3
4
5
6
DEFINE QLOCAL('ORDERS.BULK') TRIGGER(YES) TRIGTYPE(DEPTH) + TRIGDPTH(1000) PROCESS('ORDER.WORKER') + INITQ('INITQ.SCALE') TRIGDATA('POOL=BULK') DEFINE PROCESS('ORDER.WORKER') APPLICID('/opt/orders/worker.sh') + USERDATA('MAXMSG=200') * worker.sh: get up to 200 messages or until empty, then exit

TRIGDPTH(1000) suggests starting another worker when at least one thousand messages wait. If each worker removes two hundred messages per run, five concurrent workers might exist under sustained load—if each depth trigger starts one without cap. Application USERDATA can pass MAXMSG to limit per invocation. Operations should cap maximum instances in script or orchestration (Kubernetes replicas, etc.) when using MQ triggering as a scale signal.

Depth Trigger and Queue Full

If consumers cannot keep pace, CURDEPTH approaches MAXDEPTH and producers see 2053 queue full. Depth trigger is a prevention tool—fire extra workers before MAXDEPTH. Alert at eighty percent MAXDEPTH even with DEPTH configured. TRIGDPTH at ninety percent of MAXDEPTH leaves little time for new workers to drain before puts fail.

Combining FIRST and DEPTH

Pattern A: FIRST on primary queue starts baseline consumer when work arrives. Pattern B: DEPTH on same queue with higher TRIGDPTH adds workers when backlog grows—requires consumer idempotency or partitioned queues to avoid duplicate processing. Pattern C: separate scale queue fed by application logic—more complex. Document which pattern your estate uses; do not copy MQSC without architectural review.

Monitoring

  • CURDEPTH versus TRIGDPTH on dashboards.
  • Initiation queue depth—stuck trigger messages.
  • Process count on trigger server host.
  • Consumer lag metric: put rate minus get rate.
  • AMQERR for trigger monitor failures under load.

Troubleshooting

  1. DISPLAY QLOCAL — TRIGTYPE(DEPTH), TRIGDPTH, TRIGGER, PROCESS.
  2. DISPLAY QSTATUS — CURDEPTH above TRIGDPTH?
  3. INITQ depth and trigger monitor running?
  4. Are workers exiting immediately due to errors (poison message)?
  5. Is TRIGDPTH higher than current depth due to miscalculation?

Explainer: Call Extra Cashiers

When the supermarket line reaches ten carts (TRIGDPTH), the manager opens another checkout. Depth trigger is that policy— not opening a new checkout for the first cart only (FIRST), and not hiring one cashier per item (EVERY).

Explain Like I'm Five: Depth Trigger

When the toy box has so many toys it is hard to count to one hundred, you ask more friends to help put toys away. The number one hundred is TRIGDPTH.

Practice Exercises

Exercise 1

Lab: set TRIGDPTH(10), put 25 messages, count trigger-related activity on INITQ.

Exercise 2

Given 5 sec/msg processing and target 4 workers max, propose TRIGDPTH with shown math.

Exercise 3

List risks of DEPTH without consumer message locking strategy.

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. DEPTH trigger uses attribute:

  • TRIGDPTH
  • SSLCIPH
  • XMITQ
  • CCDT

2. DEPTH helps when:

  • Backlog grows under load
  • Queue always empty
  • Channel INACTIVE only
  • Cert expired

3. TRIGDPTH too low causes:

  • Frequent extra triggers
  • No triggers ever
  • TLS failure
  • Archive stop

4. CURDEPTH in DEPTH trigger refers to:

  • Messages on application queue
  • Channel bytes
  • LDAP entries
  • Log files
Published
Read time18 min
AuthorMainframeMaster
Verified: IBM MQ 9.3 documentation