Removing messages from the queue in ASF
When an application uses ConnectionConsumers, JMS might need to remove messages from the queue in a number of situations.
- Badly formatted message
- A message might arrive that JMS cannot parse.
- Poison message
- A message might reach the backout threshold, but the ConnectionConsumer fails to requeue it on the backout queue.
- No interested ConnectionConsumer
- For point-to-point messaging, when the QueueConnectionFactory is set so that it does not retain unwanted messages, a message arrives that is unwanted by any of the ConnectionConsumers.
- MQRO_DEAD_LETTER_Q
- The message is requeued to the queue manager's dead-letter queue. This is the default.
- MQRO_DISCARD_MSG
- The message is discarded.
- MQRO_EXCEPTION
- A report message is generated that contains the MQMD of the original message. It does not contain any message body data.
- MQRO_EXCEPTION_WITH_DATA
- A report message is generated that contains the MQMD, any MQ headers, and 100 bytes of body data.
- MQRO_EXCEPTION_WITH_FULL_DATA
- A report message is generated that contains all data from the original message.
- default
- No report message is generated.
- MQRO_NEW_MSG_ID
- MQRO_PASS_MSG_ID
- MQRO_COPY_MSG_ID_TO_CORREL_ID
- MQRO_PASS_CORREL_ID
If a poison message cannot be requeued, perhaps because the dead-letter queue is full or authorization is wrongly specified, what happens depends on the persistence of the message. If the message is nonpersistent, the message is discarded and no report message is generated. If the message is persistent, delivery of messages to all connection consumers listening on that destination stops. Such connection consumers must be closed and the problem resolved before they can be re-created and message delivery restarted.
It is important to define a dead-letter queue, and to check it regularly to ensure that no problems occur. Particularly, ensure that the dead-letter queue does not reach its maximum depth, and that its maximum message size is large enough for all messages.
- PutApplType is
MQAT_JAVA (0x1C)
- PutApplName is "
MQ JMS ConnectionConsumer
"
These fields are in the MQDLH of messages on the dead-letter queue, and the MQMD of report messages. The feedback field of the MQMD, and the Reason field of the MQDLH, contain a code describing the error. For details about these codes, see Reason and feedback codes in ASF. Other fields are as described in MQDLH - Dead-letter header.