You can call this operation to query the detailed information of a consumer group with a specified group ID, including the subscriptions, statistics on consumption transactions per second (TPS), load balancing status, and consumer instance connections.

Note the following when calling the OnsConsumerStatus operation:

  • The OnsConsumerStatus operation is usually applicable to scenarios where you want to locate causes for consumption exceptions after roughly ruling out message accumulation and the online status of consumer instances. Based on the responses, you can determine whether the subscriptions of consumer instances with a specified group ID are consistent and whether load balancing is normal, and obtain Jstack information of online consumer instances.
  • The OnsConsumerStatus operation needs to call a large number of backend API operations to aggregate data. Therefore, the query is slow. We recommend that you do not call this operation frequently.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes OnsConsumerStatus

The operation that you want to perform. Set the value to OnsConsumerStatus.

GroupId String Yes GID_test_group_id

The consumer group ID that you want to query.

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance corresponding to the consumer group ID.

Detail Boolean No true

Specifies whether to query detailed information. Valid values:

  • true: Queries detailed information. You can obtain the detailed information from the returned ConsumerConnectionInfoList and DetailInTopicList parameters.
  • false: does not query detailed information. The value is the default value. The returned ConsumerConnectionInfoList and DetailInTopicList parameters are empty.
NeedJstack Boolean No true

Specifies whether to print Jstack information. Valid values:

  • true: prints Jstack information. You can obtain the Jstack information from the returned Jstack parameter.
    Note If you need to print Jstack information, ensure that the Detail parameter in the request is set to true.
  • false: does not print Jstack information. The value is the default value. The returned Jstack parameter is empty.

Response parameters

Parameter Type Example Description
Data Struct

The returned query results.

ConnectionSet Array

Information about online consumer instances in the consumer group.

ConnectionDo
ClientAddr String 30.5.121.**

The address and port number of the consumer instance.

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

The ID of the consumer instance.

Language String JAVA

The language used by the consumer instance.

RemoteIP String 42.120.74.**

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

Version String V4_3_6_SNAPSHOT

The version of the consumer instance.

ConsumeModel String CLUSTERING

The consumption pattern of the consumer group. Valid values:

  • CLUSTERING: clustering consumption
  • BROADCASTING: broadcasting consumption

For more information about the two consumption patterns, seeClustering consumption and broadcasting consumption.

ConsumeTps Float 0

The total consumption TPS of the consumer group.

ConsumerConnectionInfoList Array

Details about online consumer instances in the group, including the Jstack information and consumption response time (RT). If you need to obtain more information, ensure that the Detail parameter in the request is set to true. Otherwise, the returned value is empty.

ConsumerConnectionInfoDo
ClientId String 30.5.**. **@25560#-1999745829#-1737591554#458773089270275

The ID of the consumer instance.

Connection String **

The connection information of the consumer instance.

ConsumeModel String CLUSTERING

The consumption pattern of the consumer instance. Valid values:

  • CLUSTERING: clustering consumption
  • BROADCASTING: broadcasting consumption

For more information about the two consumption patterns, seeClustering consumption and broadcasting consumption.

ConsumeType String PUSH

The message consumption mode of the consumer. Valid values:

  • PUSH: The Message Queue for Apache RocketMQ broker pushes messages to the consumer.
  • PULL: The consumer pulls messages from the Message Queue for Apache RocketMQ broker.
Jstack Array

Jstack information of the consumer instance. If you need to obtain Jstack information, ensure that the NeedJstack parameter in the request is set to true. Otherwise, the returned value is empty.

ThreadTrackDo
Thread String ConsumeMessageThread_0

The name of the thread used by the consumer instance.

TrackList List TID: 52 STATE: WAITING

The Jstack string of the consumer instance.

Language String JAVA

The language used by the consumer instance.

LastTimeStamp Long 1570701368114

The last consumption time of the consumer instance.

RunningDataList Array

The real-time statistics of the consumer instance.

ConsumerRunningDataDo
FailedCountPerHour Long 0

The number of messages that failed to be consumed by the consumer instance per hour.

FailedTps Float 0

The TPS statistics of message consumption failures for the consumer instance.

GroupId String 0

The group ID corresponding to the consumer instance.

OkTps Float 0

The TPS statistics of successful message consumption for the consumer instance.

Rt Float 0

The consumption RT of the consumer instance. Unit: milliseconds.

Topic String test-mq_topic

The name of the topic to which the consumer instance has subscribed.

StartTimeStamp Long 1570701361528

The timestamp indicating when the consumer instance starts consumption.

SubscriptionSet Array

A returned set of subscriptions.

SubscriptionData
SubString String *

The tag expression of the topic to which the consumer instance has subscribed.

SubVersion Long 1570701364301

The version of the subscription. The value is auto-incremented and of the Long type.

TagsSet List ff

A returned set of tags to which the consumer instance has subscribed.

Topic String test-mq_topic

The name of the topic to which the consumer instance has subscribed.

ThreadCount Integer 20

The number of consumption threads used by the consumer instance.

Version String V4_3_6

The version of the consumer instance.

DelayTime Long 100857

The consumption latency of the consumer group.

DetailInTopicList Array

The consumption status of each topic to which the consumer group has subscribed. If you need to obtain more information, ensure that the Detail parameter in the request is set to true. Otherwise, the returned value is empty.

DetailInTopicDo
DelayTime Long 0

The consumption latency of the topic.

LastTimestamp Long 1570701259403

The last consumption time of the topic.

Topic String test-mq_topic

The name of the topic.

TotalDiff Long 0

The total number of accumulated messages in the topic.

InstanceId String MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance corresponding to the specified group ID.

LastTimestamp Long 1566883844954

The last consumption time of the group ID.

Online Boolean true

Indicates whether the group ID is online.

RebalanceOK Boolean true

Indicates whether the rebalancing among consumer instances is normal. Valid values:

  • true: normal
  • false: abnormal
SubscriptionSame Boolean true

Indicates whether the subscriptions are consistent in the consumer group.

TotalDiff Long 197

The total number of accumulated messages for the group.

RequestId String 10EDC518-10E7-4B34-92FB-171235FA6E38

The ID of the request. This is a common parameter.

Examples

Sample requests

http(s)://[Endpoint]/? Action=OnsConsumerStatus
&GroupId=GID_test_group_id
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&NeedJstack=true
&Detail=true
&<Common request parameters>

Sample success responses

XML format

<OnsConsumerStatusResponse>
  <data>
        <connectionSet>
              <bizVersion>V4_3_6</bizVersion>
              <clientAddr>30.5. ***.*</clientAddr>
              <clientId>30.5. ***.*@97730#-1999745829#-1737591554#729272961762836</clientId>
              <language>JAVA</language>
              <version>V4_3_6</version>
        </connectionSet>
        <consumeModel>CLUSTERING</consumeModel>
        <consumeTps>0</consumeTps>
        <consumerConnectionInfoList>
              <bizVersion>V4_3_6</bizVersion>
              <clientId>30.5. ***.*@97730#-1999745829#-1737591554#729272961762836</clientId>
              <consumeType>PUSH</consumeType>
              <jstack>
                    <thread>ConsumeMessageThread_4</thread>
                    <trackList>TID: 44 STATE: WAITING</trackList>
                    <trackList>sun.misc.Unsafe.park(Native Method)</trackList>
                    <trackList>java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)</trackList>
                    <trackList>java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)</trackList>
                    <trackList>java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)</trackList>
                    <trackList>java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)</trackList>
                    <trackList>java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)</trackList>
                    <trackList>java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)</trackList>
                    <trackList>java.lang.Thread.run(Thread.java:748)</trackList>
              </jstack>
              <language>JAVA</language>
              <lastTimeStamp>1570701368114</lastTimeStamp>
              <runningDataList>
                    <failedCountPerHour>0</failedCountPerHour>
                    <failedTps>0</failedTps>
                    <okTps>0</okTps>
                    <rt>0</rt>
                    <topic>test-mq_topic</topic>
              </runningDataList>
              <startTimeStamp>1570701361528</startTimeStamp>
              <subscriptionSet>
                    <subString>*</subString>
                    <subVersion>1570701364301</subVersion>
                    <topic>test-mq_topic</topic>
              </subscriptionSet>
              <threadCount>20</threadCount>
              <version>V4_3_6</version>
        </consumerConnectionInfoList>
        <delayTime>0</delayTime>
        <detailInTopicList>
              <delayTime>0</delayTime>
              <lastTimestamp>1570701259403</lastTimestamp>
              <topic>test-mq_topic</topic>
              <totalDiff>0</totalDiff>
        </detailInTopicList>
        <instanceId>MQ_INST_111111111111_DOxxxxxx</instanceId>
        <lastTimestamp>1570701368114</lastTimestamp>
        <online>true</online>
        <rebalanceOK>true</rebalanceOK>
        <subscriptionSame>true</subscriptionSame>
        <totalDiff>0</totalDiff>
  </data>
  <requestId>10EDC518-10E7-4B34-92FB-171235FA6E38</requestId>
</OnsConsumerStatusResponse>

JSON format

{
  "data": {
    "connectionSet": [
      {
        "bizVersion": "V4_3_6",
        "clientAddr": "30.5. ***.*",
        "clientId": "30.5. ***.*@97730#-1999745829#-1737591554#729272961762836",
        "language": "JAVA",
        "version": "V4_3_6"
      }
    ],
    "consumeModel": "CLUSTERING",
    "consumeTps": 0,
    "consumerConnectionInfoList": [
      {
        "bizVersion": "V4_3_6",
        "clientId": "30.5. ***.*@97730#-1999745829#-1737591554#729272961762836",
        "consumeType": "PUSH",
        "jstack": [
          {
            "thread": "ConsumeMessageThread_1",
            "trackList": [
              "TID: 44 STATE: WAITING",
              "sun.misc.Unsafe.park(Native Method)",
              "java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)",
              "java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)",
              "java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)",
              "java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)",
              "java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)",
              "java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)",
              "java.lang.Thread.run(Thread.java:748)"
            ]
          }
        ],
        "language": "JAVA",
        "lastTimeStamp": 1570701368114,
        "runningDataList": [
          {
            "failedCountPerHour": 0,
            "failedTps": 0,
            "okTps": 0,
            "rt": 0,
            "topic": "test-mq_topic"
          }
        ],
        "startTimeStamp": 1570701361528,
        "subscriptionSet": [
          {
            "subString": "*",
            "subVersion": 1570701364301,
            "tagsSet": [],
            "topic": "test-mq_topic"
          }
        ],
        "threadCount": 20,
        "version": "V4_3_6"
      }
    ],
    "delayTime": 0,
    "detailInTopicList": [
      {
        "delayTime": 0,
        "lastTimestamp": 1570701259403,
        "topic": "test-mq_topic",
        "totalDiff": 0
      }
    ],
    "instanceId": "MQ_INST_111111111111_DOxxxxxx",
    "lastTimestamp": 1570701368114,
    "online": true,
    "rebalanceOK": true,
    "subscriptionSame": true,
    "totalDiff": 0
  },
  "requestId": "10EDC518-10E7-4B34-92FB-171235FA6E38"
}

Error codes

For a list of error codes, visit the API Error Center.