MQDLH - Dead letter header
The MQDLH structure describes the information that prefixes the application message data of messages on the dead letter (undelivered-message) queue. A message can arrive on the dead letter queue either because the queue manager or message channel agent has redirected it to the queue, or because an application has put the message directly on the queue.
Format name
MQFMT_DEAD_LETTER_HEADER
Character set and encoding
The fields in the MQDLH structure are in the character set and encoding given by the
CodedCharSetId
and Encoding
fields. These are specified in the header structure that precedes the MQDLH, or in the MQMD
structure if the MQDLH is at the start of the application message data.
The character set must be one that has single-byte characters for the characters that are valid in queue names.
If you are using the IBM® MQ classes for Java/JMS, and the code page defined in the MQMD is not supported by the Java virtual machine, then the MQDLH is written in the UTF-8 character set.
Usage
Applications that put messages directly on the dead letter queue must prefix the message data with an MQDLH structure, and initialize the fields with appropriate values. However, the queue manager does not require that an MQDLH structure be present, or that valid values have been specified for the fields.
- Truncate the message data to fit on the dead letter queue.
- Record the message on auxiliary storage and place an exception report message on the dead letter queue indicating this.
- Discard the message and return an error to its originator. If the message is (or might be) a critical message, do this only if it is known that the originator still has a copy of the message; for example, a message received by a message channel agent from a communication channel.
The queue manager performs special processing when a message that is a segment is put with an MQDLH structure at the front; see the description of the MQMDE structure for further details.
Putting messages on the dead letter queue
- Set the
CodedCharSetId
andEncoding
fields to whatever character set and encoding are used for fields in the MQDLH structure. - Set the
Format
field to MQFMT_DEAD_LETTER_HEADER to indicate that the data begins with a MQDLH structure. - Set the context fields (
AccountingToken
,ApplIdentityData
,ApplOriginData
,PutApplName
,PutApplType
,PutDate
,PutTime
,UserIdentifier
) by using a context option appropriate to the circumstances:- An application putting on the dead letter queue a message that is not related to any preceding message must use the MQPMO_DEFAULT_CONTEXT option; this causes the queue manager to set all of the context fields in the message descriptor to their default values.
- A server application putting on the dead letter queue a messagethat it has just received must use the MQPMO_PASS_ALL_CONTEXT option to preserve the original context information.
- A server application putting on the dead letter queue a reply to a message that it has just received must use the MQPMO_PASS_IDENTITY_CONTEXT option; this preserves the identity information but sets the origin information to be that of the server application.
- A message channel agent putting on the dead letter queue a messagethat it received from its communication channel must use the MQPMO_SET_ALL_CONTEXT option to preserve the original context information.
- Set the
CodedCharSetId
,Encoding
, andFormat
fields to the values that describe the data that follows the MQDLH structure, usually the values from the original message descriptor. - Set the context fields
PutApplType
,PutApplName
,PutDate
, andPutTime
to values appropriate to the application that is putting the message on the dead letter queue; these values are not related to the original message. - Set other fields as appropriate.
Ensure that all fields have valid values, and that character fields are padded with blanks to the defined length of the field; do not end the character data prematurely by using a null character, because the queue manager does not convert the null and subsequent characters to blanks in the MQDLH structure.
Getting messages from the dead letter queue
Applications that get messages from the dead letter queue must verify that the messages begin
with an MQDLH structure. The application can determine whether an MQDLH structure is present by
examining the Format
field in the message descriptor MQMD; if
the field has the value MQFMT_DEAD_LETTER_HEADER, the message data begins with an MQDLH structure.
Be aware also that messages that applications get from the dead letter queue might be truncated if
they were originally too long for the queue.
Fields
Field name and description | Name of constant | Initial value (if any) of constant |
---|---|---|
StrucId (structure identifier) | MQDLH_STRUC_ID | 'DLH¬' |
Version (structure version number) | MQDLH_VERSION_1 | 1 |
Reason (reason message arrived on dead letter queue) | MQRC_NONE | 0 |
DestQName (name of original destination queue) | None | Null string or blanks |
DestQMgrName (name of original destination queue manager) | None | Null string or blanks |
Encoding (numeric encoding of data that follows MQDLH) | None | 0 |
CodedCharSetId (character set identifier of data that follows MQDLH) | MQCCSI_UNDEFINED | 0 |
Format (format name of data that follows MQDLH) | MQFMT_NONE | Blanks |
PutApplType (type of application that put message on dead letter queue) | None | 0 |
PutApplName (name of application that put message on dead letter queue) | None | Null string or blanks |
PutDate (date when message was put on dead letter queue) | None | Null string or blanks |
PutTime (time when message was put on dead letter queue) | None | Null string or blanks |
Notes:
|
Language declarations
C declaration for MQDLH
typedef struct tagMQDLH MQDLH;
struct tagMQDLH {
MQCHAR4 StrucId; /* Structure identifier */
MQLONG Version; /* Structure version number */
MQLONG Reason; /* Reason message arrived on dead-letter
(undelivered-message) queue */
MQCHAR48 DestQName; /* Name of original destination queue */
MQCHAR48 DestQMgrName; /* Name of original destination queue
manager */
MQLONG Encoding; /* Numeric encoding of data that follows
MQDLH */
MQLONG CodedCharSetId; /* Character set identifier of data that
follows MQDLH */
MQCHAR8 Format; /* Format name of data that follows
MQDLH */
MQLONG PutApplType; /* Type of application that put message on
dead-letter (undelivered-message)
queue */
MQCHAR28 PutApplName; /* Name of application that put message on
dead-letter (undelivered-message)
queue */
MQCHAR8 PutDate; /* Date when message was put on dead-letter
(undelivered-message) queue */
MQCHAR8 PutTime; /* Time when message was put on the
dead-letter (undelivered-message)
queue */
};
COBOL declaration for MQDLH
** MQDLH structure
10 MQDLH.
** Structure identifier
15 MQDLH-STRUCID PIC X(4).
** Structure version number
15 MQDLH-VERSION PIC S9(9) BINARY.
** Reason message arrived on dead-letter (undelivered-message) queue
15 MQDLH-REASON PIC S9(9) BINARY.
** Name of original destination queue
15 MQDLH-DESTQNAME PIC X(48).
** Name of original destination queue manager
15 MQDLH-DESTQMGRNAME PIC X(48).
** Numeric encoding of data that follows MQDLH
15 MQDLH-ENCODING PIC S9(9) BINARY.
** Character set identifier of data that follows MQDLH
15 MQDLH-CODEDCHARSETID PIC S9(9) BINARY.
** Format name of data that follows MQDLH
15 MQDLH-FORMAT PIC X(8).
** Type of application that put message on dead-letter
** (undelivered-message) queue
15 MQDLH-PUTAPPLTYPE PIC S9(9) BINARY.
** Name of application that put message on dead-letter
** (undelivered-message) queue
15 MQDLH-PUTAPPLNAME PIC X(28).
** Date when message was put on dead-letter (undelivered-message)
** queue
15 MQDLH-PUTDATE PIC X(8).
** Time when message was put on the dead-letter (undelivered-message)
** queue
15 MQDLH-PUTTIME PIC X(8).
PL/I declaration for MQDLH
dcl
1 MQDLH based,
3 StrucId char(4), /* Structure identifier */
3 Version fixed bin(31), /* Structure version number */
3 Reason fixed bin(31), /* Reason message arrived on
dead-letter (undelivered-message)
queue */
3 DestQName char(48), /* Name of original destination
queue */
3 DestQMgrName char(48), /* Name of original destination queue
manager */
3 Encoding fixed bin(31), /* Numeric encoding of data that
follows MQDLH */
3 CodedCharSetId fixed bin(31), /* Character set identifier of data
that follows MQDLH */
3 Format char(8), /* Format name of data that follows
MQDLH */
3 PutApplType fixed bin(31), /* Type of application that put
message on dead-letter
(undelivered-message) queue */
3 PutApplName char(28), /* Name of application that put
message on dead-letter
(undelivered-message) queue */
3 PutDate char(8), /* Date when message was put on
dead-letter (undelivered-message)
queue */
3 PutTime char(8); /* Time when message was put on the
dead-letter (undelivered-message)
queue */
High Level Assembler declaration for MQDLH
MQDLH DSECT
MQDLH_STRUCID DS CL4 Structure identifier
MQDLH_VERSION DS F Structure version number
MQDLH_REASON DS F Reason message arrived on dead-letter
* (undelivered-message) queue
MQDLH_DESTQNAME DS CL48 Name of original destination queue
MQDLH_DESTQMGRNAME DS CL48 Name of original destination queue
* manager
MQDLH_ENCODING DS F Numeric encoding of data that follows
* MQDLH
MQDLH_CODEDCHARSETID DS F Character set identifier of data that
* follows MQDLH
MQDLH_FORMAT DS CL8 Format name of data that follows MQDLH
MQDLH_PUTAPPLTYPE DS F Type of application that put message on
* dead-letter (undelivered-message) queue
MQDLH_PUTAPPLNAME DS CL28 Name of application that put message on
* dead-letter (undelivered-message) queue
MQDLH_PUTDATE DS CL8 Date when message was put on
* dead-letter (undelivered-message) queue
MQDLH_PUTTIME DS CL8 Time when message was put on the
* dead-letter (undelivered-message) queue
*
MQDLH_LENGTH EQU *-MQDLH
ORG MQDLH
MQDLH_AREA DS CL(MQDLH_LENGTH)
Visual Basic declaration for MQDLH
Type MQDLH
StrucId As String*4 'Structure identifier'
Version As Long 'Structure version number'
Reason As Long 'Reason message arrived on dead-letter'
'(undelivered-message) queue'
DestQName As String*48 'Name of original destination queue'
DestQMgrName As String*48 'Name of original destination queue'
'manager'
Encoding As Long 'Numeric encoding of data that follows'
'MQDLH'
CodedCharSetId As Long 'Character set identifier of data that'
'follows MQDLH'
Format As String*8 'Format name of data that follows MQDLH'
PutApplType As Long 'Type of application that put message on'
'dead-letter (undelivered-message) queue'
PutApplName As String*28 'Name of application that put message on'
'dead-letter (undelivered-message) queue'
PutDate As String*8 'Date when message was put on dead-letter'
'(undelivered-message) queue'
PutTime As String*8 'Time when message was put on the'
'dead-letter (undelivered-message) queue'
End Type