Processing messages on an IBM MQ dead-letter queue
To process messages on a dead-letter queue (DLQ), IBM MQ supplies a default DLQ handler. The handler matches messages on the DLQ against entries in a rules table that you define.
Messages can be put on a DLQ by queue managers, message channel agents (MCAs), and applications. All messages on the DLQ must be prefixed with a dead-letter header structure, MQDLH. Messages put on the DLQ by a queue manager or a message channel agent always have this header; applications putting messages on the DLQ must supply this header. The Reason field of the MQDLH structure contains a reason code that identifies why the message is on the DLQ.
All IBM MQ environments need a routine to process messages on the DLQ regularly. IBM MQ supplies a default routine, called the dead-letter queue handler (the DLQ handler), which you invoke using the runmqdlq command.
Instructions for processing messages on the DLQ are supplied to the DLQ handler by means of a user-written rules table. That is, the DLQ handler matches messages on the DLQ against entries in the rules table; when a DLQ message matches an entry in the rules table, the DLQ handler performs the action associated with that entry.
- The dead-letter queue handler on IBM i
What is the IBM i dead-letter queue handler, and how do you invoke it? - Invoking the DLQ handler
Invoke the dead-letter queue handler using the runmqdlq command. We can name the DLQ we want to process and the queue manager we want to use in two ways. - The DLQ handler rules table
The dead-letter queue handler rules table defines how the DLQ handler processes messages that arrive on the DLQ. - How the DLQ rules table is processed
The dead-letter queue handler searches the rules table for a rule where the pattern matches a message on the DLQ. - An example DLQ handler rules table
An example dead-letter queue rules table for the runmqdlq command, containing a single control-data entry and several rules.
Parent topic: Work with dead-letter queues
Related information