Queries the detailed status information of a specified group ID, including the subscriptions, statistics on consumption transactions per second (TPS), load balancing status, and consumer connection.

Take note of the following points when you call the OnsConsumerStatus operation:

  • The OnsConsumerStatus operation is typically applicable when you want to find causes for consumption exceptions after you roughly identity the status of message accumulation and the connection status of consumers. Based on the responses, you can determine whether the subscriptions of consumers of a specified group ID are consistent and whether load balancing is normal. You can also obtain Jstack information of online consumers.
  • The OnsConsumerStatus operation must call a large number of backend API operations to aggregate data. Therefore, the query is slow. We recommend that you do not frequently call this operation.

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 whose detailed status information you want to query.

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the instance where the consumer group ID is located.

Detail Boolean No true

Specifies whether to query detailed information. Valid values:

  • true: queries detailed information. You can obtain the detailed information from the ConsumerConnectionInfoList and DetailInTopicList response parameters.
  • false: does not query detailed information. This value is the default value. The ConsumerConnectionInfoList and DetailInTopicList response 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 Jstack response parameter.
    Note If you need to print Jstack information, make sure that the Detail parameter in the request is set to true.
  • false: does not print Jstack information. This value is the default value. The Jstack response parameter is empty.

Response parameters

Parameter Type Example Description
Data Struct

The returned query results.

ConnectionSet Array

The information about online consumers 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 programming language in which the consumer was developed.

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.

ConsumeModel String CLUSTERING

The consumption mode. Valid values:

  • CLUSTERING: clustering consumption
  • BROADCASTING: broadcasting consumption

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

ConsumeTps Float 0

The total consumption TPS.

ConsumerConnectionInfoList Array

The details about online consumers in the consumer group, including the Jstack information and consumption response time (RT). If you need to query more information, make sure 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.

ConsumeModel String CLUSTERING

The consumption mode. Valid values:

  • CLUSTERING: clustering consumption
  • BROADCASTING: broadcasting consumption

For more information about the two consumption modes, see Clustering 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

The Jstack information. If you need to query the Jstack information, make sure 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.

TrackList List TID: 52 STATE: WAITING

The string of Jstack information.

Language String JAVA

The programming language in which the consumer was developed.

LastTimeStamp Long 1570701368114

The latest consumption time.

RunningDataList Array

The real-time statistics.

ConsumerRunningDataDo
FailedCountPerHour Long 0

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

FailedTps Float 0

The TPS statistics of messages that failed to be consumed.

GroupId String 0

The group ID of the subscriber.

OkTps Float 0

The TPS statistics of messages that were consumed.

Rt Float 0

The consumption RT. Unit: milliseconds.

Topic String test-mq_topic

The name of the subscribed topic.

StartTimeStamp Long 1570701361528

The start time of consumption, in the timestamp format.

SubscriptionSet Array

A returned set of subscriptions.

SubscriptionData
SubString String *

The tag expression of the subscribed topic.

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 of the subscribed topic.

Topic String test-mq_topic

The name of the subscribed topic.

ThreadCount Integer 20

The number of consumer threads.

Version String V4_3_6

The version of the consumer.

DelayTime Long 100857

The consumption latency.

DetailInTopicList Array

The consumption status of each subscribed topic. If you need to query more information, make sure that the Detail parameter in the request is set to true. Otherwise, the returned value is empty.

DetailInTopicDo
DelayTime Long 0

The consumption latency.

LastTimestamp Long 1570701259403

The latest consumption time.

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 instance.

LastTimestamp Long 1566883844954

The latest consumption time.

Online Boolean true

Indicates whether the group ID is online.

RebalanceOK Boolean true

Indicates whether the rebalancing among consumers is normal. Valid values:

  • true: normal
  • false: abnormal
SubscriptionSame Boolean true

Indicates whether the subscriptions are consistent.

TotalDiff Long 197

The total number of accumulated messages in the cluster.

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

The ID of the request, which is a common parameter. Each request has a unique ID.

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.