Queries a dead-letter message by specifying the message ID.

Usage notes

It is an exact search to query a dead-letter message based on a specified message ID. You can query the message ID required for the query condition from SendResult after the message is sent or by calling the operation for batch query. The queried information includes properties such as the storage time, message body, message key, and message tag.

QPS limit

The queries-per-second (QPS) limit on this operation is 10 per user. Throttling is triggered when the number of calls to this operation exceeds this limit. Throttling may affect your business. Therefore, call this operation based on your needs. For more information, see QPS limits.

Authorization information

By default, only Alibaba Cloud accounts can call this operation. Resource Access Management (RAM) users can call this operation only after they are authorized. The following table lists the authorization information of this operation. For more information, see Policies and examples.

API

Action

Resource with a namespace

Resource without a namespace

OnsDLQMessageGetById

mq:QueryDLQMessage

acs:mq:*:*:{instanceId}%{groupId}

acs:mq:*:*:{groupId}

Request parameters

Parameter Type Required Example Description
Action String Yes OnsDLQMessageGetById

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

MsgId String Yes 0BC16699165C03B925DB8A404E2D****

The ID of the dead-letter message that you want to query.

GroupId String Yes GID_test_group_id

The consumer group ID that corresponds to the dead-letter message to be queried.

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance that corresponds to the dead-letter message to be queried.

Note For more information about request parameters, see Common parameters and Make API requests.

Response parameters

Parameter Type Example Description
RequestId String A07E3902-B92E-44A6-B6C5-6AA111111****

The ID of the request. This parameter is a common parameter. Each request has a unique ID.

Data Object

The query results.

StoreSize Integer 407

The size of the message. Unit: KB.

ReconsumeTimes Integer 1

The number of retries after the message has failed to be consumed.

StoreTimestamp Long 1570761026708

The time when the Message Queue for Apache RocketMQ broker stored the message. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC.

InstanceId String MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance.

MsgId String 0BC16699165C03B925DB8A404E2D****

The ID of the message.

StoreHost String 11.220.***.***:10911

The Message Queue for Apache RocketMQ broker that stored the message.

Topic String test-mq_topic

The topic of the message.

PropertyList Array of MessageProperty

The list of properties of the message.

MessageProperty
Value String TagA

The value of the message property.

Name String TAGS

The property of the message. Valid values:

  • TRACE_ON: indicates whether a trace of the message exists.
  • KEYS: indicates the key property of the message.
  • TAGS: indicates the tag property of the message.
  • INSTANCE_ID: indicates the ID of the Message Queue for Apache RocketMQ instance that corresponds to the message.

For more information about the terms, see Terms.

BornTimestamp Long 1570761026630

The time when the message was generated. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC.

BodyCRC Integer 914112295

The cyclic redundancy check (CRC) value of the message body.

BornHost String 42.120.**.**:64646

The producer instance that generated the message.

Examples

Sample requests

http(s)://ons.cn-hangzhou.aliyuncs.com/?Action=OnsDLQMessageGetById
&GroupId=GID_test_group_id
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&MsgId=0BC16699165C03B925DB8A404E2D****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<OnsDLQMessageGetByIdResponse>
<Data>
    <MsgId>1E0578FE110F18B4AAC235C0C8460BA2</MsgId>
    <InstanceId>MQ_INST_111111111111_DOxxxxxx</InstanceId>
    <ReconsumeTimes>1</ReconsumeTimes>
    <BornHost>42.120.**.**:64646</BornHost>
    <BodyCRC>914112295</BodyCRC>
    <StoreHost>11.220.***.***: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>
        <MessageProperty>
            <Name>RETRY_TOPIC</Name>
            <Value>MQ_INST_111111111111_DOxxxxxx%test-mq_topic</Value>
        </MessageProperty>
        <MessageProperty>
            <Name>KEYS</Name>
            <Value>ORDERID_993</Value>
        </MessageProperty>
        <MessageProperty>
            <Name>UNIQ_KEY</Name>
            <Value>1E0578FE110F18B4AAC235C0C84*****</Value>
        </MessageProperty>
        <MessageProperty>
            <Name>WAIT</Name>
            <Value>false</Value>
        </MessageProperty>
        <MessageProperty>
            <Name>TAGS</Name>
            <Value>TagA</Value>
        </MessageProperty>
        <MessageProperty>
            <Name>INSTANCE_ID</Name>
            <Value>MQ_INST_111111111111_DOxxxxxx</Value>
        </MessageProperty>
    </PropertyList>
</Data>
<RequestId>A07E3902-B92E-44A6-B6C5-6AA111111****</RequestId>
</OnsDLQMessageGetByIdResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Data" : {
    "MsgId" : "0BC16699165C03B925DB8A404E2D****",
    "InstanceId" : "MQ_INST_111111111111_DOxxxxxx",
    "ReconsumeTimes" : 1,
    "BornHost" : "42.120.**.**:64646",
    "BodyCRC" : 914112295,
    "StoreHost" : "11.220.***.***:10911",
    "StoreTimestamp" : 1570761026708,
    "BornTimestamp" : 1570761026630,
    "Topic" : "test-mq_topic",
    "StoreSize" : 407,
    "PropertyList" : {
      "MessageProperty" : [ {
        "Name" : "TRACE_ON",
        "Value" : "true"
      }, {
        "Name" : "RETRY_TOPIC",
        "Value" : "MQ_INST_111111111111_DOxxxxxx%test-mq_topic"
      }, {
        "Name" : "KEYS",
        "Value" : "ORDERID_993"
      }, {
        "Name" : "UNIQ_KEY",
        "Value" : "1E0578FE110F18B4AAC235C0C84*****"
      }, {
        "Name" : "WAIT",
        "Value" : "false"
      }, {
        "Name" : "TAGS",
        "Value" : "TagA"
      }, {
        "Name" : "INSTANCE_ID",
        "Value" : "MQ_INST_111111111111_DOxxxxxx"
      } ]
    }
  },
  "RequestId" : "A07E3902-B92E-44A6-B6C5-6AA111111****"
}

Error codes

For a list of error codes, visit the API Error Center.

Operations in the Message Queue for Apache RocketMQ console

In addition to calling the OnsDLQMessageGetById operation, you can query dead-letter messages in the Message Queue for Apache RocketMQ console. For more information, see Dead-letter queues.