You can call the OnsDLQMessageGetById API to query dead-letter messages with a specified Message ID. The queried information includes the storage time, body, Key, Tag, and other attributes of the dead-letter message.

An exact query is performed by querying dead-letter messages by Message ID. You can obtain the Message ID required for the query condition from SendResult after the Message is sent or by calling the batch query operation.

Debugging

You can directly run this interface in OpenAPI Explorer, saving you from the trouble of calculating the signature. After the SDK runs successfully, OpenAPI Explorer automatically generates SDK code examples.

Request parameters

Name Type Required or not Sample value Description
Action String Yes OnsDLQMessageGetById

The operation that you want to perform. Set the value to OnsDLQMessageGetById.

GroupId String Yes GID_test_group_id

The Group ID of the consumer you want to query.

MsgId String Yes Number of frontend servers *

The ID of the Message you want to query, that is, the Message ID.

InstanceId String No Mq_inst_1111111111_doxxxxxx

The ID of the instance for which you want to query messages. This parameter is required for instances with independent namespaces.

Response Data

Name Type Sample value Description
RequestId String A07E3902-B92E-44A6-B6C5-6AA1111111799

A common parameter. Each request has a unique ID.

Data Struct

Query Results

Topic String test-mq_topic

The Topic of the message.

Body String Renewal

Message body

StoreSize Integer 407

Message Size

BornTimestamp Long 1570761026630

The timestamp stored by the server.

BornHost String 42.120. **. **: 64646

The client instance that generates the message.

StoreTimestamp Long 1570761026708

The timestamp stored by the server.

StoreHost String 11.220. Special questions *. ***: 10911

The server instance that stores the message.

MsgId String Number of frontend servers *

The message ID.

BodyCRC Integer 914112295

The message body CRC value.

ReconsumeTimes Integer 1

The number of retries for message consumption.

InstanceId String Mq_inst_1111111111_doxxxxxx

Instance ID

PropertyList Array

The list of message properties.

Name String TAGS

The message property. Valid values:

  • TRACE_ON: Whether the message trace is enabled
  • KEYS: The Key attribute of the message.
  • TAGS: The Tag attribute of the message.
  • INSTANCE_ID: ID of the instance where the message is located.

For more information, see Terms.

Value String TagA

The value of the message property.

Example

Request example

http(s)://[Endpoint]/? Action=OnsDLQMessageGetById
&GroupId=GID_test_group_id
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&MsgId=0BC16699165C03B925DB8A404E2D****
& <Common request parameters>

Normal response example

JSONFormat

{
  &quot;Data&quot;: {
    &quot;MsgId&quot;: &quot;0BC16699165C03B925DB8A404E2D****&quot;,
    &quot;Body&quot;: &quot;SGVsbG8gTVEg5raT7oWf5p6D5ai05ayt55iv&quot;,
    &quot;InstanceId&quot;: &quot;MQ_INST_111111111111_DOxxxxxx&quot;,
    &quot;ReconsumeTimes&quot;: 1,
    &quot;BornHost&quot;: &quot;42.120. Cause *. **: 64646 &quot;,
    &quot;BodyCRC&quot;: 914112295,
    &quot;StoreHost&quot;: &quot;11.220. Supported regions *. ***: 10911 &quot;,
    &quot;StoreTimestamp&quot;: 1570761026708,
    &quot;BornTimestamp&quot;: 1570761026630,
    &quot;Topic&quot;: &quot;test-mq_topic&quot;,
    &quot;StoreSize&quot;: 407,
    &quot;PropertyList&quot;: {
      &quot;MessageProperty&quot;:[
                {
                    &quot;Name&quot;:&quot;TRACE_ON&quot;,
                    &quot;Value&quot;:&quot;true&quot;
                }
            ]
        }
    },
  &quot;RequestId&quot;: &quot;A07E3902-B92E-44A6-B6C5-6AA1111111799&quot;
}

XMLFormat

<OnsDLQMessageGetByIdResponse>
  <Data>
        <MsgId>0BC16699165C03B925DB8A404E2D****</MsgId>
        <Body>SGVsbG8gTVEg5raT7oWf5p6D5ai05ayt55iv</Body>
        <InstanceId>MQ_INST_111111111111_DOxxxxxx</InstanceId>
        <ReconsumeTimes>1</ReconsumeTimes>
        <BornHost>42.120. Cause *. **:64646</BornHost>
        <BodyCRC>914112295</BodyCRC>
        <StoreHost>11.220. Supported regions *. ***:10911</StoreHost>
        <StoreTimestamp>1570761026708</StoreTimestamp>
        <BornTimestamp>1570761026630</BornTimestamp>
        <Topic>test-mq_topic</Topic>
        <StoreSize>407</StoreSize>
        <PropertyList>
              <MessageProperty>
                    <Name>TRACE_ON</Name>
                    <Value>true</Value>
              </MessageProperty>
        </PropertyList>
  </Data>
  <RequestId>A07E3902-B92E-44A6-B6C5-6AA1111111799</RequestId>
</OnsDLQMessageGetByIdResponse>

Error code

AccessError CenterFor more information, see error codes.