You can use OnsConsumerStatus to query the detailed status data of a specified Group ID, including subscription check, consumption TPS statistics, load balancing status, and consumer connection.

When calling the OnsConsumerStatus API, note the following:

  • The OnsConsumerStatus API is used to locate the causes of consumption exceptions after roughly determining the consumption accumulation and the online status of the client. based on the returned results, you can determine whether the subscriptions of a specified Group ID are consistent, whether server load balancer is normal, and obtain Jstack information of online clients.
  • The OnsConsumerStatus API needs to call a large number of backend interfaces for data aggregation, so the query speed is slow. It is not recommended to call frequently.

Debugging

You can directly run this interface in OpenAPI Explorer, saving you from the trouble of calculating the signature. After the SDK runs successfully, OpenAPI Explorer automatically generates SDK code examples.

Request parameters

Name Type Required or not Sample value 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 Group ID of the consumer you want to query.

InstanceId String Yes Mq_inst_1111111111_doxxxxxx

The instance ID corresponding to the Group ID you want to query.

This parameter is optional for instances without namespaces. You can log on to the RocketMQ console,Instance Details page to check whether the instance has a namespace.

Detail Boolean No True

Indicates whether to query the details. Valid values:

  • True: To query details, you can obtain the ConsumerConnectionInfoList and DetailInTopicList response parameters.
  • False: Default value, indicating that no details are queried, that is, the returned parametersConsumerConnectionInfoListAndDetailInTopicListis empty.
NeedJstack Boolean No True

Indicates whether to print Jstack information. Valid values:

  • True: The Jstack information to be printed. You can obtain the stack information in the Jstack response parameters.
    Note To print the Jstack information, make sure that your input parameter Detail is set toTrue.
  • False: Default value. Jstack information is not printed. The Jstack response parameter is empty.

Response Data

Name Type Sample value Description
RequestId String Renewal

A common parameter. Each request has a unique ID.

Data Struct

The query result.

Online Boolean True

Indicates whether the device is online.

TotalDiff Long 197

The total consumption accumulation of the cluster.

ConsumeTps Float 0

Total consumption TPS.

LastTimestamp Long 1566883844954

The last consumption time.

DelayTime Long 100857

The delay time.

ConsumeModel String CLUSTERING

The consumption model. Valid values:

  • CLUSTERING: Clustering consumption mode
  • BROADCASTING: Broadcasting consumption mode

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

SubscriptionSame Boolean True

Subscription consistency.

RebalanceOK Boolean True

Indicates whether the client Rebalance is normal. Valid values:

  • True: Normal
  • False: abnormal
InstanceId String Mq_inst_1111111111_doxxxxxx

The ID of the instance.

ConnectionSet Array

The information about online clients in the cluster.

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

The ID of the consumer instance.

ClientAddr String 30.5.121. Conclusion *

The address and port of the consumer instance.

Language String JAVA

The language of the consumer.

Version String V4_3_6_SNAPSHOT

The version of the consumer.

RemoteIP String 42.120.74. Remarks *

The host IP address or public IP address.

DetailInTopicList Array

The consumption of each Topic. For more information, make sure that the Detail input parameter is set toTrue. Otherwise, the return value is null.

Topic String test-mq_topic

The name of the Topic.

TotalDiff Long 0

The total consumption accumulation of the Topic.

LastTimestamp Long 1570701259403

The last consumption time.

DelayTime Long 0

The delay time.

ConsumerConnectionInfoList Array

Details of online clients in the cluster, including Jstack and RT consumption time. For more information, make sure that the Detail input parameter is set to True. Otherwise, the return value is null.

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

The ID of the consumer instance.

Connection String Remarks *

Connection information.

Language String JAVA

The client language.

Version String V4_3_6

The client version.

ConsumeModel String CLUSTERING

The consumption model. Valid values:

  • CLUSTERING: Clustering consumption mode
  • BROADCASTING: Broadcasting consumption mode

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

ConsumeType String PUSH

The mode in which consumers consume messages. Valid values:

  • PUSH: The RocketMQ broker actively pushes messages to consumers.
  • PULL: The consumer actively pulls messages from the RocketMQ broker.
ThreadCount Integer 20

The number of consumption threads.

StartTimeStamp Long 1570701361528

The start time of consumption.

LastTimeStamp Long 1570701368114

The last consumption time.

SubscriptionSet Array

A set of subscription relationships.

Topic String test-mq_topic

The name of the Topic to be subscribed to.

SubString String *

The sub-category Tag expression that subscribes to the Topic.

SubVersion Long 1570701364301

The subscription version, which is an auto-increment Long type.

TagsSet List FF

The Tag set to be subscribed to.

RunningDataList Array

Real-time status statistics.

GroupId String 0

The Group ID of the subscriber.

Topic String test-mq_topic

The name of the Topic to be subscribed to.

Rt Float 0

The RT of the consumption. Unit: ms.

OkTps Float 0

The TPS statistics of successful message consumption.

FailedTps Float 0

The TPS statistics of message consumption failures.

FailedCountPerHour Long 0

The number of messages that failed to be consumed in an hour.

Jstack Array

Jstack information. To obtain Jstack information, make sure that the NeedJstack input parameter is set toTrue. Otherwise, the return value is null.

Thread String ConsumeMessageThread_0

The name of the thread.

TrackList List TID: 52 STATE: WAITING

The Jstack information string.

Example

Request example

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

Normal response example

XMLFormat

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

JSONFormat

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

Error code

AccessError CenterFor more information, see error codes.