Using the Dead Message Queue

The dead message queue,mq.sys.dmq,
is a system-created physical destination that holds the dead messages of a
broker's physical destinations. The dead message queue is a tool for monitoring,
tuning system efficiency, and troubleshooting. For a definition of the term dead message and a more detailed introduction to the dead message
queue, see the Message Queue Technical Overview.

The broker automatically creates a dead message queue when it starts.
The broker places messages on the queue if it cannot process them or if their
time-to-live has expired. In addition, other physical destinations can use
the dead message queue to hold discarded messages. This can provide information
that is useful for troubleshooting the system.

Managing the Dead Message Queue

The physical destination
configuration property useDMQ controls a destination’s
use of the dead message queue. Physical destinations are configured to use
the dead message queue by default; to disable a destination from using it,
set the destination’s useDMQ property to false:

imqcmd update dst -t q -n curlyQueue -o useDMQ=false

You can enable or disable the use of the dead message queue for all
auto-created physical destinations on a broker by setting the broker’s imq.autocreate.destination.useDMQ broker property:

imqcmd update bkr -o imq.autocreate.destination.useDMQ=false

You can manage the dead message queue with the Message Queue Command
utility (imqcmd) just as you manage other queues, but with
some differences. For example, because the dead message queue is system-created,
you cannot create, pause, or destroy it. Also, as shown in Table 7–2, default values for the dead
message queue’s configuration properties sometimes differ from those
of ordinary queues.

Default value is 1000, rather than -1 (unlimited)
as for ordinary queues.

maxTotalMsgBytes

Default value is 10m (10 megabytes), rather than -1 (unlimited) as for ordinary queues.

limitBehavior

Default value is REMOVE_OLDEST, rather than REJECT_NEWEST as for ordinary queues.

FLOW_CONTROL is not supported for the dead message
queue.

maxNumProducers

Does not apply to the dead message queue.

isLocalOnly

Permanently set to false in broker clusters; the
dead message queue in a cluster is always a global physical destination.

localDeliveryPreferred

Does not apply to the dead message queue.

Tip –

By default, the dead message queue stores
entire messages. If you do not plan to restore dead messages, you can reduce
the size of the dead message queue by setting the broker’s imq.destination.DMQ.truncateBody property to true:

imqcmd update bkr -o imq.destination.DMQ.truncateBody=true

This will discard the body of all messages
and retain only the headers and property data.

Enabling Dead Message Logging

The broker configuration property logDeadMsgs controls
the logging of events related to the dead message queue. When dead message
logging is enabled, the broker will log the following events:

A message is moved to the dead message queue.

A message is discarded from the dead message queue (or from
any physical destination that does not use the dead message queue).

A physical destination reaches its limits.

Dead message logging is disabled by default. The following command enables
it:

imqcmd update bkr -o imq.destination.logDeadMsgs=true

Note –

Dead message logging applies to all physical destinations that
use the dead message queue. You cannot enable or disable logging for an individual
physical destination.