All Products
Search
Document Center

ApsaraMQ for RocketMQ:GetConsumerGroupLag

Last Updated:Dec 19, 2025

Queries the message accumulation of a consumer group.

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

rocketmq:GetConsumerGroupLag

get

*ConsumerGroup

acs:rocketmq:{#regionId}:{#accountId}:instance/{#InstanceId}/consumergroup/{#ConsumerGroupId}

None None

Request syntax

GET /instances/{instanceId}/consumerGroups/{consumerGroupId}/lag HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

instanceId

string

Yes

The instance ID.

rmq-cn-2r42vrvde0j

consumerGroupId

string

Yes

The consumer group ID.

CID-TEST

Request parameters

Parameter

Type

Required

Description

Example

topicName

string

No

The name of the topic to which the consumer group subscribes.

normal-topic-1

liteTopicName

string

No

The name of the lite topic.

abc

Response elements

Element

Type

Description

Example

object

Result<ConsumerGroupLagDto>

requestId

string

The request ID.

F5764C40-FB8C-53AE-B95D-96AB3D0E9375

success

boolean

Indicates whether the request was successful.

true

data

object

The returned data.

regionId

string

The region ID.

cn-hangzhou

instanceId

string

The instance ID.

rmq-cn-7e22ody****

consumerGroupId

string

The consumer group ID.

CID-TEST

totalLag

object

The total message accumulation.

readyCount

integer

The number of ready messages.

1

inflightCount

integer

The number of inflight messages.

1

deliveryDuration

integer

The delivery latency. Unit: seconds.

12

lastConsumeTimestamp

integer

The timestamp of the last consumption.

1735629607846

topicLagMap

object

The message accumulation for each topic.

object

The message accumulation details.

readyCount

integer

The number of ready messages.

1

inflightCount

integer

The number of inflight messages.

1

deliveryDuration

integer

The delivery latency. Unit: seconds.

12

lastConsumeTimestamp

integer

The timestamp of the last consumption.

1735629607846

topicName

string

The name of the subscribed topic.

test1

liteTopicLagMap

object

The message accumulation for lite topics.

object

The message accumulation for the lite topic.

readyCount

integer

The number of accumulated messages.

300

deliveryDuration

integer

The delivery latency. Unit: seconds.

30

code

string

The error code.

Topic.NotFound

message

string

The error message.

Parameter instanceId is mandatory for this action .

httpStatusCode

integer

The HTTP status code.

200

dynamicCode

string

The dynamic error code.

InstanceId

dynamicMessage

string

The dynamic error message.

instanceId

Examples

Success response

JSON format

{
  "requestId": "F5764C40-FB8C-53AE-B95D-96AB3D0E9375",
  "success": true,
  "data": {
    "regionId": "cn-hangzhou",
    "instanceId": "rmq-cn-7e22ody****",
    "consumerGroupId": "CID-TEST",
    "totalLag": {
      "readyCount": 1,
      "inflightCount": 1,
      "deliveryDuration": 12,
      "lastConsumeTimestamp": 1735629607846
    },
    "topicLagMap": {
      "key": {
        "readyCount": 1,
        "inflightCount": 1,
        "deliveryDuration": 12,
        "lastConsumeTimestamp": 1735629607846
      }
    },
    "topicName": "test1",
    "liteTopicLagMap": {
      "key": {
        "readyCount": 300,
        "deliveryDuration": 30
      }
    }
  },
  "code": "Topic.NotFound",
  "message": "Parameter instanceId is mandatory for this action .",
  "httpStatusCode": 200,
  "dynamicCode": "InstanceId",
  "dynamicMessage": "instanceId"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.