Queries the information about a dead-letter message by using the message ID.
Usage notes
If you query a dead-letter message by using the message ID, the system performs exact matching. You can obtain the message ID that is required to query the information about the dead-letter message by calling the operation to query multiple messages at a time or based on the information that is returned for SendResult. You can obtain the information that is returned for SendResult after the dead-letter message is sent. The queried information about the dead-letter message includes the point in time when the message is stored, message body, and attributes such as the tag and message key.
QPS limit
Each Alibaba Cloud account can call this operation up to 10 times per second. If the number of requests that you send each second to call this operation exceeds the queries per second (QPS) limit, throttling is triggered. This may interrupt your business. For more information, see QPS limits.
Authorization
By default, only Alibaba Cloud accounts can call this operation. A Resource Access Management (RAM) user can call this operation only after the RAM user is granted the required permissions. The following table describes the permissions that are required to call this operation. For more information, see Policies and examples.
|
API |
Action |
Resource in an instance that contains a namespace |
Resource in an instance that does not contain a namespace |
|---|---|---|---|
|
OnsDLQMessageGetById |
mq:QueryInstanceBaseInfo 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 group ID of the consumer group that you want to query. |
| InstanceId | String | Yes | MQ_INST_111111111111_DOxxxxxx |
The ID of the instance that contains the dead-letter message you want to query. |
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 results that are returned. |
|
| StoreSize | Integer | 407 |
The size of the dead-letter message. Unit: KB. |
| ReconsumeTimes | Integer | 1 |
The number of retries that Message Queue for Apache RocketMQ performed to send the dead-letter message to consumers. |
| StoreTimestamp | Long | 1570761026708 |
The timestamp that indicates the point in time when the Message Queue for Apache RocketMQ broker stored the dead-letter message. Unit: milliseconds. |
| InstanceId | String | MQ_INST_111111111111_DOxxxxxx |
The ID of the instance. |
| MsgId | String | 0BC16699165C03B925DB8A404E2D**** |
The ID of the dead-letter message. |
| StoreHost | String | 11.220.***.***:10911 |
The Message Queue for Apache RocketMQ broker that stores the dead-letter message. |
| Topic | String | test-mq_topic |
The topic to which the dead-letter message belongs. |
| PropertyList | Array of MessageProperty |
The attributes of the dead-letter message. |
|
| MessageProperty | |||
| Value | String | TagA |
The value of an attribute. |
| Name | String | TAGS |
The name of the attribute. Valid values:
For more information about the terms that are used in Message Queue for Apache RocketMQ, see Terms. |
| BornTimestamp | Long | 1570761026630 |
The timestamp that indicates the point in time when the dead-letter message was generated. Unit: milliseconds. |
| BodyCRC | Integer | 914112295 |
The cyclic redundancy check (CRC) value of the message body. |
| BornHost | String | 42.120.**.**:64646 |
The producer instance that generated the dead-letter 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.
Query the information about a dead-letter message by using the console
Besides calling the OnsDLQMessageGetById operation, you can use the Message Queue for Apache RocketMQ console to query the information about a dead-letter message. For information about how to use the Message Queue for Apache RocketMQ console to query the information about a dead-letter message, see Dead-letter queues.