Queries all dead-letter messages in a group within a period of time by page.
Operation description
-
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 specified consumer group within a specified time range. The results are returned by page.
-
We recommend that you specify a short time range to query dead-letter messages in this method. If you specify a long time range, a large number of dead-letter messages are returned. In this case, you cannot find the dead-letter message that you want to query in an efficient manner. You can perform the following steps to query dead-letter messages:
- Perform a paged query by specifying the group ID, start time, end time, and number of entries to return on each page. If matched messages are found, the information about the dead-letter messages on the first page, total number of pages, and task ID are returned by default.
- 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.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
mq:QueryDLQMessage | Read |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
GroupId | string | Yes | The ID of the consumer group whose dead-letter messages you want to query. | GID_test_group_id |
BeginTime | long | Yes | The beginning of the time range to query. The value of this parameter is a UNIX timestamp in milliseconds. 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. | 1570723200000 |
EndTime | long | Yes | The end of the time range to query. The value of this parameter is a UNIX timestamp in milliseconds. 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. | 1570809600000 |
TaskId | string | No | The ID of the query task. The first time you call this operation to query dead-letter messages that are sent to a specified consumer group within 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 returned result of the first query. | 0BC1310300002A9F000021E4D7A48346 |
CurrentPage | integer | Yes | The number of the page to return. Pages start from page 1. Valid values: 1 to 50. | 2 |
PageSize | integer | No | The number of dead-letter 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. | 5 |
InstanceId | string | Yes | The ID of the instance to which the dead-letter messages you want to query belong. | MQ_INST_111111111111_DOxxxxxx |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "B00CD3C8-D81E-4A41-85E2-38F19252****",
"MsgFoundDo": {
"CurrentPage": 1,
"MsgFoundList": {
"OnsRestMessageDo": [
{
"StoreSize": 406,
"ReconsumeTimes": 1,
"StoreTimestamp": 1570760999811,
"InstanceId": "MQ_INST_111111111111_DOxxxxxx",
"MsgId": "1E0578FE110F18B4AAC235C05F2*****",
"StoreHost": "11.193.***.***:10911",
"Topic": "test-mq_topic",
"PropertyList": {
"MessageProperty": [
{
"Value": "TagA",
"Name": "TAGS"
}
]
},
"BornTimestamp": 1570760999721,
"BodyCRC": 914112295,
"BornHost": "42.120.***.***:59270"
}
]
},
"MaxPageCount": 400,
"TaskId": "0BC1310300002A9F000021E4D7A48346"
}
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|
View dead-letter messages in the console
You can also view the dead-letter messages of a consumer group in the ApsaraMQ for RocketMQ console.**** For more information, see Dead-letter queues.