All Products
Search
Document Center

ApsaraMQ for RocketMQ:OnsDLQMessagePageQueryByGroupId

Last Updated:Dec 12, 2025

Queries dead-letter messages by page for a specified Group ID and time range.

Operation description

Important Alibaba Cloud OpenAPI is a management API. You can use it to manage and query Alibaba Cloud service resources. Integrate this API for management purposes only. Do not use this API for core data links that send and receive messages because this can create security threats.
  • Querying dead-letter messages by Group ID is a paged range query. This method applies only to scenarios in which you query messages without specifying a message ID.

  • When you query dead-letter messages by Group ID, specify a time range that is as short as possible. A long time range can return too many messages and make it difficult to identify issues. The call flow is as follows:
    1. For the first paged query, specify the Group ID, start time, end time, and the number of messages per page. If messages are found, the API returns the messages on the first page, the total number of pages, and a query task ID.

    2. Use the returned query task ID to retrieve more pages of messages. In subsequent requests, specify the query task ID and the page number. The start time, end time, and number of messages per page in these requests are ignored because the values from the first query are used.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

mq:QueryDLQMessage

get

Group

acs:mq:{#regionId}:{#accountId}:{#GroupName}

Group

acs:mq:{#regionId}:{#accountId}:{#InstanceId}%{#GroupName}

None
  • mq:OnsInstanceBaseInfo

Request parameters

Parameter

Type

Required

Description

Example

GroupId

string

Yes

The ID of the consumer group to query.

GID_test_group_id

BeginTime

integer

Yes

The start of the time range to query. This value is a UNIX timestamp in milliseconds. If you specify TaskId to retrieve more pages, this parameter is ignored. The start time from the first query is used.

1570723200000

EndTime

integer

Yes

The end of the time range to query. This value is a UNIX timestamp in milliseconds. If you specify TaskId to retrieve more pages, this parameter is ignored. The end time from the first query is used.

1570809600000

TaskId

string

No

The ID of the query task. Omit this parameter for the first query. For subsequent queries, use the task ID returned by the previous query.

0BC1310300002A9F000021E4D7A48346

CurrentPage

integer

Yes

The page number to return. Pages start from 1. The value can be up to 50 and must not exceed the total number of pages.

2

PageSize

integer

No

The number of messages to return on each page. Default value: 20. Minimum value: 5. Maximum value: 50. If you specify TaskId to retrieve more pages, this parameter is ignored. The page size from the first query is used.

5

InstanceId

string

No

The ID of the instance that contains the message.

MQ_INST_111111111111_DOxxxxxx

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID. Each request has a unique ID. Use this ID to troubleshoot issues.

B00CD3C8-D81E-4A41-85E2-38F19252****

MsgFoundDo

object

The query result.

CurrentPage

integer

The current page number.

1

MsgFoundList

object

OnsRestMessageDo

array<object>

The list of messages on the current page. The data type is the same as the data type of the response to the OnsDLQMessageGetById operation.

array<object>

StoreSize

integer

The message size in KB.

406

ReconsumeTimes

integer

The number of times the message has been reconsumed.

1

StoreTimestamp

integer

The UNIX timestamp for when the message was stored on the server.

1570760999811

InstanceId

string

The instance ID.

MQ_INST_111111111111_DOxxxxxx

MsgId

string

The message ID.

1E0578FE110F18B4AAC235C05F2*****

StoreHost

string

The server that stores the message.

11.193.***.***:10911

Topic

string

The topic of the message.

test-mq_topic

PropertyList

object

MessageProperty

array<object>

A list of message properties.

object

Value

string

The value of the message property.

TagA

Name

string

The message property. Valid values:

  • TRACE_ON: Indicates whether a message trace exists.

  • KEYS: The key of the message.

  • TAGS: The tag of the message.

  • INSTANCE_ID: The ID of the instance that contains the message.

For more information, see Terms.

TAGS

BornTimestamp

integer

The UNIX timestamp for when the message was produced.

1570760999721

BodyCRC

integer

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

914112295

BornHost

string

The producer that generated the message.

42.120.***.***:59270

MaxPageCount

integer

The total number of pages available.

400

TaskId

string

The ID of the query task. This ID is returned on the first query. Use this ID to retrieve subsequent pages.

0BC1310300002A9F000021E4D7A48346

Examples

Success response

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

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.