What is Dead Letter Queue (DLQ) & Dear Letter Queue Handler (DLH) and How to Configure it ?

What is Dead Letter Queue (DLQ) and Dead Letter Queue Handling (DLH)?


11)      A dead-letter queue (DLQ), sometimes referred to as an undelivered-message queue, is a holding queue for messages that cannot be delivered to their destination queues. Every queue manager in a network should have an associated DLQ.

22)      Messages can be put on the 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.

33)      Messages put on the DLQ by a queue manager or a message channel agent always have an MQDLH; applications putting messages on the DLQ must supply an MQDLH. The Reason field of the MQDLH structure contains a reason code that identifies why the message is on the DLQ.

44)      All WebSphere MQ environments need a routine to process messages on the DLQ regularly. WebSphere MQ supplies a default routine, called the dead-letter queue handler (the DLQ handler), which you invoke using the runmqdlq command.

55)      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.

 

How to Configuring a DLQ ?


Each Queuemanager has to have a defined dead letter queue.
In mq commad interface, list for the below attribute

(e.g)
mqm@mqm: dis qmgr deadq
AMQ8408: Display Queue Manager details.
   QMNAME(QM1)                             DEADQ()

Define a local queue to be configured as a DLQ or we can use the SYSTEM.DEAD.LETTER.QUEUE

Here am creating a queue called DEADQ1.

Define ql(DEADQ1) maxdepth(50000)

Then alter the qmgr property as below:

alter qmgr deadq(DEADQ1)

Now list the property and cross-check

mqm@mqm : dis qmgr deadq
AMQ8408: Display Queue Manager details.
   QMNAME(QM1)                             DEADQ(DEADQ1)

With the above step, configuring a DLQ for the queue manager is done.

How to Configure DLQ handler rules table?


Now before we invoke the DLQ handler, we need to define a set of rules to be followed by the handler on the messages that arrive into the DLQ.

The DLQ handler rules table defines how the DLQ handler is to process messages that arrive on the DLQ.

Entries of the rules into the table has to be made for the DLQ handler to follow. Each rule consists of a pattern (a set of message characteristics) that a message is matched against, and an action to be taken when a message on the DLQ matches the specified pattern.

There must be at least one rule in a rules table.

I have defined a rule table 'SFDLQRules.rul'in path /var/mqm .

Below is the rule table I have defined for a sample [Listed below in purple]. The rule table written are user specific and can be customised as per the need. The rule table is in '.rul' format.

test@server01:~> cat /var/mqm/SFDLQRules.rul
INPUTQM('') INPUTQ('') RETRYINT(300) WAIT(YES)

DESTQ(Q1) REASON(MQRC_PUT_INHIBITED) ACTION(RETRY) RETRY(2)

DESTQ(Q1) REASON(2362) ACTION(RETRY) RETRY(2)

Comments