Queries the dead-letter messages that are sent to a specified consumer group within a specified time range.
Usage notes
- If you do not know the ID of the dead-letter message that you want to query, you can call this operation to query all dead-letter messages that are sent to a consumer group within a specified time range. The results are displayed by page.
-
We recommend that you specify a short time range to query messages. If you specify a long time range, a large number of messages are returned. In this case, you need a long period of time to find the message that you want to query. You can perform the following steps to query dead-letter messages:
1. Specify the Topic, BeginTime, EndTime, and PageSize parameters to call this operation to create a query task. By default, this operation returns the information about the dead-letter messages on the first page, total number of pages, and task ID.
2. Specify the task ID and a page number to call this operation again to query the dead-letter messages on the specified page. In this query, the BeginTime, EndTime, and PageSize parameters do not take effect. By default, the system uses the values of these parameters that you specified in the request when you created the specified query task.
Request limit
Each Alibaba Cloud account can call this operation up to 10 times per second. If the number of requests that you send to call this operation within 1 second reaches the request limit, new requests fail. This may interrupt your business. For information about the request limit of each operation, see API rate 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 must be granted to a RAM user to call this operation. For information about how to grant permissions, Policies and examples.
API |
Action |
Resource in an instance that uses a namespace |
Resource in an instance that does not use a namespace |
---|---|---|---|
OnsDLQMessagePageQueryByGroupId |
mq:QueryInstanceBaseInfo mq:QueryDLQMessage |
acs:mq:*:*:{instanceId}%{groupId} |
acs:mq:*:*:{groupId} |
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | OnsDLQMessagePageQueryByGroupId |
The operation that you want to perform. Set the value to OnsDLQMessagePageQueryByGroupId. |
GroupId | String | Yes | GID_test_group_id |
The ID of the consumer group whose dead-letter messages you want to query. |
BeginTime | Long | Yes | 1570723200000 |
The beginning of the time range to query. Set the value to a UNIX timestamp that represents the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC. If you specify a valid value for the TaskId parameter in the request, this parameter does not take effect. The system uses the value of the BeginTime parameter that you specified in the request when you created the specified query task. |
EndTime | Long | Yes | 1570809600000 |
The end of the time range to query. Set the value to a UNIX timestamp that represents the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC. If you specify a valid value for the TaskId parameter in the request, this parameter does not take effect. The system uses the value of the EndTime parameter that you specified in the request when you created the specified query task. |
TaskId | String | No | 0BC1310300002A9F000021E4D7A48346 |
The ID of the query task. The first time you call this operation to query dead-letter messages that are sent to a consumer group in a specified time range, this parameter is not required. This parameter is required in subsequent queries for dead-letter messages on a specified page. You can obtain the task ID from the response of the first query. |
CurrentPage | Integer | Yes | 2 |
The number of the page to return. Pages start from page 1. Valid values: 1 to 50. |
PageSize | Integer | No | 5 |
The number of messages to return on each page. Valid values: 5 to 50. Default value: 20. If you specify a valid value for the TaskId parameter in the request, this parameter does not take effect. The system uses the value of the PageSize parameter that you specified in the request when you created the specified query task. |
InstanceId | String | Yes | MQ_INST_111111111111_DOxxxxxx |
The ID of the Message Queue for Apache RocketMQ instance that contains the consumer group. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | B00CD3C8-D81E-4A41-85E2-38F19252**** |
The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID. |
MsgFoundDo | Object |
The information about dead-letter messages that are queried. |
|
CurrentPage | Long | 1 |
The page number of the returned page. |
MsgFoundList | Array of OnsRestMessageDo |
The information about dead-letter messages that are returned on the current page. The information that is contained in this parameter is the same as the information that is returned by the OnsDLQMessageGetById operation. |
|
OnsRestMessageDo | |||
StoreSize | Integer | 406 |
The size of the 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 | 1570760999811 |
The point in time when the Message Queue for Apache RocketMQ broker stored the message. |
InstanceId | String | MQ_INST_111111111111_DOxxxxxx |
The ID of the instance. |
MsgId | String | 1E0578FE110F18B4AAC235C05F2***** |
The ID of the message. |
StoreHost | String | 11.193.***.***:10911 |
The Message Queue for Apache RocketMQ broker that stores the message. |
Topic | String | test-mq_topic |
The topic in which the message is stored. |
PropertyList | Array of MessageProperty |
The properties of the message. |
|
MessageProperty | |||
Value | String | TagA |
The value of the property. |
Name | String | TAGS |
The name of the property. Valid values:
For information about the terms that are used in Message Queue for Apache RocketMQ, see Terms. |
BornTimestamp | Long | 1570760999721 |
The point in time when the message was produced. |
BodyCRC | Integer | 914112295 |
The cyclic redundancy check (CRC) value of the message body. |
BornHost | String | 42.120.***.***:59270 |
The producer instance that generated the message. |
MaxPageCount | Long | 400 |
The total number of result pages. |
TaskId | String | 0BC1310300002A9F000021E4D7A48346 |
The ID of the query task. The first time you call this operation to query the dead-letter messages that are published to a topic in a specified time range, this parameter is returned. You can use the task ID to query the details of dead-letter messages on other returned pages. |
Examples
Sample requests
http(s)://ons.cn-hangzhou.aliyuncs.com/?Action=OnsDLQMessagePageQueryByGroupId
&BeginTime=1570723200000
&CurrentPage=2
&EndTime=1570809600000
&GroupId=GID_test_group_id
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&TaskId=0BC1310300002A9F000021E4D7A48346
&PageSize=5
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<OnsDLQMessagePageQueryByGroupIdResponse>
<MsgFoundDo>
<MaxPageCount>400</MaxPageCount>
<MsgFoundList>
<OnsRestMessageDo>
<MsgId>1E0578FE110F18B4AAC235C05F2*****</MsgId>
<InstanceId>MQ_INST_111111111111_DOxxxxxx</InstanceId>
<ReconsumeTimes>1</ReconsumeTimes>
<BornHost>42.120.***.***:59270</BornHost>
<StoreTimestamp>1570760999811</StoreTimestamp>
<StoreHost>11.193.***.***:10911</StoreHost>
<BodyCRC>914112295</BodyCRC>
<Topic>test-mq_topic</Topic>
<BornTimestamp>1570760999721</BornTimestamp>
<StoreSize>406</StoreSize>
<PropertyList>
<MessageProperty>
<Name>TAGS</Name>
<Value>TagA</Value>
</MessageProperty>
</PropertyList>
</OnsRestMessageDo>
</MsgFoundList>
<TaskId>0BC1310300002A9F000021E4D7A48346</TaskId>
<CurrentPage>1</CurrentPage>
</MsgFoundDo>
<RequestId>5DC2A47E-2B31-4722-96C8-FA59C9*****</RequestId>
</OnsDLQMessagePageQueryByGroupIdResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"OnsDLQMessagePageQueryByGroupIdResponse" : {
"MsgFoundDo" : {
"MaxPageCount" : 400,
"MsgFoundList" : {
"OnsRestMessageDo" : {
"MsgId" : "1E0578FE110F18B4AAC235C05F2*****",
"InstanceId" : "MQ_INST_111111111111_DOxxxxxx",
"ReconsumeTimes" : 1,
"BornHost" : "42.120.***.***:59270",
"StoreTimestamp" : 1570760999811,
"StoreHost" : "11.193.***.***:10911",
"BodyCRC" : 914112295,
"Topic" : "test-mq_topic",
"BornTimestamp" : 1570760999721,
"StoreSize" : 406,
"PropertyList" : {
"MessageProperty" : [ {
"Name" : "TAGS",
"Value" : "TagA"
} ]
}
}
},
"TaskId" : "0BC1310300002A9F000021E4D7A48346",
"CurrentPage" : 1
},
"RequestId" : "5DC2A47E-2B31-4722-96C8-FA59C9*****"
}
}
Error codes
For a list of error codes, visit the API Error Center.
Query dead-letter messages in the console
You can also query the dead-letter messages of a consumer group in the Message Queue for Apache RocketMQ console. For more information, see Dead-letter queues.