Working with dead-letter queues

Each queue manager typically has a local queue to use as a dead-letter queue, so that messages that cannot be delivered to their correct destination can be stored for later retrieval. You tell the queue manager about the dead-letter queue, and specify how messages found on a dead-letter queue are to be processed. Using dead-letter queues can affect the sequence in which messages are delivered, so you might choose not to use them.

Before you begin

Note: The steps in this task require you to run MQSC commands. How you do this varies by platform. See Administering IBM® MQ using MQSC commands.

About this task

A sample dead-letter queue called SYSTEM.DEAD.LETTER.QUEUE is available with the product. This queue is automatically created when you create the queue manager. You can modify this definition if required, and rename it.

A dead-letter queue has no special requirements except that:

  • It must be a local queue
  • Its MAXMSGL (maximum message length) attribute must enable the queue to accommodate the largest messages that the queue manager has to handle plus the size of the dead-letter header (MQDLH)

Using dead-letter queues can affect the sequence in which messages are delivered, so you might choose not to use them.

Procedure

  • Tell the queue manager about the dead-letter queue.

    To do this, specify a dead-letter queue name on the crtmqm command (crtmqm -u DEAD.LETTER.QUEUE, for example), or by using the DEADQ attribute on the ALTER QMGR command to specify one later. You must define the dead-letter queue before using it.

  • Specify how messages found on a dead-letter queue are to be processed.

    You set the USEDLQ channel attribute to determine whether the dead-letter queue is used when messages cannot be delivered. This attribute can be configured so that some functions of the queue manager use the dead-letter queue, while other functions do not. For more information about the use of the USEDLQ channel attribute on different MQSC commands, see DEFINE CHANNEL, DISPLAY CHANNEL, ALTER CHANNEL, and DISPLAY CLUSQMGR.

    You use the IBM MQ dead-letter queue handler to specify how messages found on a dead-letter queue are to be processed or removed. See Processing messages on an IBM MQ dead-letter queue.