ImqDeadLetterHeader C++ class

This class encapsulates features of the MQDLH data structure.

Figure 1. ImqDeadLetterHeader class

Objects of this class are typically used by an application that encounters an message that cannot be processed. A new message comprising a dead-letter header and the message content is placed on the dead-letter queue, and the message is discarded.


Object attributes

    dead-letter reason code
    The reason the message arrived on the dead-letter queue. The initial value is MQRC_NONE.

    destination queue manager name
    The name of the original destination queue manager. The name is a string of length MQ_Q_MGR_NAME_LENGTH. Its initial value is null.

    destination queue name
    The name of the original destination queue. The name is a string of length MQ_Q_NAME_LENGTH. Its initial value is null.

    put application name
    The name of the application that put the message on the dead-letter queue. The name is a string of length MQ_PUT_APPL_NAME_LENGTH. Its initial value is null.

    put application type
    The type of application that put the message on the dead-letter queue. The initial value is zero.

    put date
    The date when the message was put on the dead-letter queue. The date is a string of length MQ_PUT_DATE_LENGTH. Its initial value is a null string.

    put time
    The time when the message was put on the dead-letter queue. The time is a string of length MQ_PUT_TIME_LENGTH. Its initial value is a null string.


Constructors

    ImqDeadLetterHeader( );
    The default constructor.

    ImqDeadLetterHeader( const ImqDeadLetterHeader & header );
    The copy constructor.


Overloaded ImqItem methods

    virtual ImqBoolean copyOut ( ImqMessage & msg );
    Inserts an MQDLH data structure into the message buffer at the beginning, moving existing message data further along. Sets the msg format to MQFMT_DEAD_LETTER_HEADER.

    See the ImqHeader class method description on page ImqHeader C++ class for further details.

    virtual ImqBoolean pasteIn ( ImqMessage & msg );
    Reads an MQDLH data structure from the message buffer.

    To be successful, the ImqMessage format must be MQFMT_DEAD_LETTER_HEADER.

    See the ImqHeader class method description on page ImqHeader C++ class for further details.


Object methods (public)

    void operator = ( const ImqDeadLetterHeader & header );
    Copies instance data is copied from header, replacing the existing instance data.

    MQLONG deadLetterReasonCode ( ) const ;
    Returns the dead-letter reason code.

    void setDeadLetterReasonCode ( const MQLONG reason );
    Sets the dead-letter reason code.

    ImqString destinationQueueManagerName ( ) const ;
    Returns the destination queue manager name, stripped of any trailing blanks.

    void setDestinationQueueManagerName ( const char * name );
    Sets the destination queue manager name. Truncates data longer than MQ_Q_MGR_NAME_LENGTH (48 characters).

    ImqString destinationQueueName ( ) const ;
    Returns a copy of the destination queue name, stripped of any trailing blanks.

    void setDestinationQueueName ( const char * name );
    Sets the destination queue name. Truncates data longer than MQ_Q_NAME_LENGTH (48 characters).

    ImqString putApplicationName ( ) const ;
    Returns a copy of the put application name, stripped of any trailing blanks.

    void setPutApplicationName ( const char * name = 0 );
    Sets the put application name. Truncates data longer than MQ_PUT_APPL_NAME_LENGTH (28 characters).

    MQLONG putApplicationType ( ) const ;
    Returns the put application type.

    void setPutApplicationType ( const MQLONG type = MQAT_NO_CONTEXT );
    Sets the put application type.

    ImqString putDate ( ) const ;
    Returns a copy of the put date, stripped of any trailing blanks.

    void setPutDate (const char * date = 0);
    Sets the put date. Truncates data longer than MQ_PUT_DATE_LENGTH (8 characters).

    ImqString putTime ( ) const ;
    Returns a copy of the put time, stripped of any trailing blanks.

    void setPutTime ( const char * time = 0 );
    Sets the put time. Truncates data longer than MQ_PUT_TIME_LENGTH (8 characters).


Object data (protected)

    MQDLH omqdlh
    The MQDLH data structure.


Reason codes

  • MQRC_INCONSISTENT_FORMAT
  • MQRC_STRUC_ID_ERROR
  • MQRC_ENCODING_ERROR

Parent topic: IBM MQ C++ classes