All Products
Search
Document Center

ApsaraMQ for RocketMQ:OnsConsumerStatus

Last Updated:Dec 12, 2025

Queries the detailed status of a specified group ID, including subscription relationships, consumption Transactions Per Second (TPS) statistics, load balancing status, and consumer connections.

Operation description

Important The Alibaba Cloud OpenAPI is a management API. Use this API to manage and query resources of Alibaba Cloud services. Integrate this API for management purposes only. Do not use this API for the core data link to send and receive messages, because this can introduce threats to your data link.
  • This operation is typically used to troubleshoot consumption exceptions after you assess the message stack and client online status. The returned result indicates whether the subscription relationships for the specified group ID are consistent and whether load balancing is normal. The result also provides the Jstack information for online clients.

  • This operation calls multiple backend operations for data aggregation, which slows down the query. Do not call this operation frequently.

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:QueryConsumerStatus

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 group ID of the consumer that you want to query.

GID_test_group_id

Detail

boolean

No

Specifies whether to query detailed information. Valid values:

  • true: Queries detailed information. The values of the ConsumerConnectionInfoList and DetailInTopicList parameters are returned.

  • false: This is the default value. Detailed information is not queried. The values of the ConsumerConnectionInfoList and DetailInTopicList parameters are empty.

true

NeedJstack

boolean

No

Specifies whether to query the Jstack information. Valid values:

  • true: Queries the Jstack information. The thread stack information is returned in the Jstack parameter.

Note

To query the Jstack information, set the Detail parameter to true.

  • false: This is the default value. The Jstack information is not queried. The value of the Jstack parameter is empty.

true

InstanceId

string

No

The ID of the instance to which the group ID that you want to query belongs.

MQ_INST_111111111111_DOxxxxxx

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID. This ID is unique to each request. Use this ID to troubleshoot issues.

10EDC518-10E7-4B34-92FB-171235FA****

Data

object

The query results.

ConsumeTps

number

The total consumption TPS.

0

ConsumeModel

string

The consumption model. Valid values:

  • CLUSTERING: The clustering consumption model.

  • BROADCASTING: The broadcasting consumption model.

For more information about the two subscription models, see Clustering consumption and broadcasting consumption.

CLUSTERING

ConnectionSet

object

ConnectionDo

array<object>

The information about the online clients in the cluster.

object

RemoteIP

string

The IP address of the host or the public IP address.

42.120.74.**

Version

string

The version of the consumer.

V4_3_6_SNAPSHOT

ClientAddr

string

The address and port of the consumer instance.

30.5.121.**

Language

string

The language of the consumer.

JAVA

ClientId

string

The ID of the consumer instance.

30.5.121.**@25560#-1999745829#-1737591554#458773089270275

TotalDiff

integer

The total number of stacked messages in the cluster.

197

ConsumerConnectionInfoList

object

ConsumerConnectionInfoDo

array<object>

The detailed information about the online clients in the cluster. This includes Jstack information and consumption response time (RT). To obtain the detailed information, set the Detail request parameter to true. Otherwise, this parameter is empty.

array<object>

test, this content is not pushed to icms

ConsumeModel

string

The consumption model. Valid values:

  • CLUSTERING: The clustering consumption model.

  • BROADCASTING: The broadcasting consumption model.

For more information about the two subscription models, see Clustering consumption and broadcasting consumption.

CLUSTERING

RunningDataList

object

ConsumerRunningDataDo

array<object>

The real-time state statistics.

object

Rt

number

The consumption RT, in milliseconds.

0

Topic

string

The name of the subscribed topic.

test-mq_topic

FailedCountPerHour

integer

The number of messages that failed to be consumed per hour.

0

OkTps

number

The TPS for successful message consumption.

0

FailedTps

number

The TPS for failed message consumption.

0

SubscriptionSet

object

SubscriptionData

array<object>

The collection of subscription relationships.

array<object>

SubString

string

The tag expression that is used to subscribe to the topic.

*

SubVersion

integer

The version number of the subscription relationship. This is an auto-incrementing long integer.

1570701364301

Topic

string

The name of the subscribed topic.

test-mq_topic

TagsSet

object

Tag

array

The collection of subscribed tags.

string

A subscribed tag.

ff

Jstack

object

ThreadTrackDo

array<object>

The Jstack information. To obtain the Jstack information, set the NeedJstack request parameter to true. Otherwise, this parameter is empty.

array<object>

test——Do not publish this content to icms

TrackList

object

Track

array

The Jstack information string.

string

A Jstack information string.

TID: 52 STATE: WAITING

Thread

string

The thread name.

ConsumeMessageThread_0

LastTimeStamp

integer

The last consumption time.

This parameter is a UNIX timestamp in milliseconds.

1570701368114

StartTimeStamp

integer

The consumption start time.

This parameter is a UNIX timestamp in milliseconds.

1570701361528

Language

string

The language of the client.

JAVA

ClientId

string

The ID of the consumer instance.

30.5.**.**@25560#-1999745829#-1737591554#458773089270275

Connection

string

The connection information.

**

Version

string

The version number of the client.

V4_3_6

ConsumeType

string

The mode in which the consumer consumes messages. Valid values:

  • PUSH: The ApsaraMQ for RocketMQ server pushes messages to the consumer.

  • PULL: The consumer pulls messages from the ApsaraMQ for RocketMQ server.

PUSH

ThreadCount

integer

The number of consumer threads.

20

InstanceId

string

The instance ID.

MQ_INST_111111111111_DOxxxxxx

DetailInTopicList

object

DetailInTopicDo

array<object>

The consumption status of each topic. To obtain the detailed information, set the Detail request parameter to true. Otherwise, this parameter is empty.

object

DelayTime

integer

The consumption latency for the specified topic, in milliseconds.

0

TotalDiff

integer

The total number of stacked messages in the topic.

0

LastTimestamp

integer

The last consumption time.

This parameter is a UNIX timestamp in milliseconds.

1570701259403

Topic

string

The topic name.

test-mq_topic

SubscriptionSame

boolean

Indicates whether the subscription relationships are consistent.

true

DelayTime

integer

The maximum consumption latency among all topics to which the specified group ID subscribes. Unit: milliseconds.

100857

LastTimestamp

integer

The last consumption time.

This parameter is a UNIX timestamp in milliseconds.

1566883844954

Online

boolean

Indicates whether the consumer is online.

true

RebalanceOK

boolean

Indicates whether client rebalancing is normal. Valid values:

  • true: Normal

  • false: Abnormal

true

Examples

Success response

JSON format

{
  "RequestId": "10EDC518-10E7-4B34-92FB-171235FA****",
  "Data": {
    "ConsumeTps": 0,
    "ConsumeModel": "CLUSTERING",
    "ConnectionSet": {
      "ConnectionDo": [
        {
          "RemoteIP": "42.120.74.**",
          "Version": "V4_3_6_SNAPSHOT",
          "ClientAddr": "30.5.121.**",
          "Language": "JAVA",
          "ClientId": "30.5.121.**@25560#-1999745829#-1737591554#458773089270275"
        }
      ]
    },
    "TotalDiff": 197,
    "ConsumerConnectionInfoList": {
      "ConsumerConnectionInfoDo": [
        {
          "ConsumeModel": "CLUSTERING",
          "RunningDataList": {
            "ConsumerRunningDataDo": [
              {
                "Rt": 0,
                "Topic": "test-mq_topic",
                "FailedCountPerHour": 0,
                "OkTps": 0,
                "FailedTps": 0
              }
            ]
          },
          "SubscriptionSet": {
            "SubscriptionData": [
              {
                "SubString": "*",
                "SubVersion": 1570701364301,
                "Topic": "test-mq_topic",
                "TagsSet": {
                  "Tag": [
                    "ff"
                  ]
                }
              }
            ]
          },
          "Jstack": {
            "ThreadTrackDo": [
              {
                "TrackList": {
                  "Track": [
                    "TID: 52 STATE: WAITING"
                  ]
                },
                "Thread": "ConsumeMessageThread_0"
              }
            ]
          },
          "LastTimeStamp": 1570701368114,
          "StartTimeStamp": 1570701361528,
          "Language": "JAVA",
          "ClientId": "30.5.**.**@25560#-1999745829#-1737591554#458773089270275",
          "Connection": "**",
          "Version": "V4_3_6",
          "ConsumeType": "PUSH",
          "ThreadCount": 20
        }
      ]
    },
    "InstanceId": "MQ_INST_111111111111_DOxxxxxx",
    "DetailInTopicList": {
      "DetailInTopicDo": [
        {
          "DelayTime": 0,
          "TotalDiff": 0,
          "LastTimestamp": 1570701259403,
          "Topic": "test-mq_topic"
        }
      ]
    },
    "SubscriptionSame": true,
    "DelayTime": 100857,
    "LastTimestamp": 1566883844954,
    "Online": true,
    "RebalanceOK": true
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.