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
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:
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
JSON
Format
{
"Data": {
"MsgId": "0BC16699165C03B925DB8A404E2D****",
"Body": "SGVsbG8gTVEg5raT7oWf5p6D5ai05ayt55iv",
"InstanceId": "MQ_INST_111111111111_DOxxxxxx",
"ReconsumeTimes": 1,
"BornHost": "42.120. Cause *. **: 64646 ",
"BodyCRC": 914112295,
"StoreHost": "11.220. Supported regions *. ***: 10911 ",
"StoreTimestamp": 1570761026708,
"BornTimestamp": 1570761026630,
"Topic": "test-mq_topic",
"StoreSize": 407,
"PropertyList": {
"MessageProperty":[
{
"Name":"TRACE_ON",
"Value":"true"
}
]
}
},
"RequestId": "A07E3902-B92E-44A6-B6C5-6AA1111111799"
}
XML
Format
<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.