Queries the details of a consumer group, including the transactions per second (TPS) for message consumption, the load balancing status, the connection information of consumer clients, and whether all consumers in the consumer group subscribe to the same topics and tags.
Note
- You can call this operation in scenarios in which consumers are online while messages are queued. You can troubleshoot errors based on the information that is returned by this operation. You can check whether all consumers in the consumer group subscribe to the same topics and tags, and whether load balancing is performed as expected. You can also obtain the information about thread stack traces of online consumers.
- This operation uses multiple backend operations to query and aggregate data. The system requires a long period of time to process a request. We recommend that you do not frequently call this operation.
Request limit
Each Alibaba Cloud account can call this operation up to 10 times per second. If the number of requests that you send to call this operation within one second reaches the request limit, new requests fail. This may interrupt your business. For information about the request limit of each operation, see API request limits.
Authorization
By default, Alibaba Cloud accounts can call this operation. A Resource Access Management (RAM) user can call this operation only after the RAM user is granted the required permissions. The following table describes the permissions that must be granted to a RAM user to call this operation. For information about how to grant permissions, see Policies.
API |
Action |
Resource in an instance that uses a namespace |
Resource in an instance that does not use a namespace |
---|---|---|---|
OnsConsumerStatus |
mq:QueryInstanceBaseInfo mq:QueryConsumerStatus |
acs:mq:*:*:{instanceId}%{groupId} |
acs:mq:*:*:{groupId} |
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 ID of the consumer group that you want to query. |
Detail | Boolean | No | true |
Specifies whether to query the details of the consumer group. Valid values:
|
NeedJstack | Boolean | No | true |
Specifies whether to query the information about thread stack traces. Valid values:
|
InstanceId | String | Yes | MQ_INST_111111111111_DOxxxxxx |
The ID of the instance to which the consumer group belongs. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 10EDC518-10E7-4B34-92FB-171235FA**** |
The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID. |
Data | Object |
The data that is returned. |
|
ConsumeTps | Float | 0 |
The TPS for message consumption. |
ConsumeModel | String | CLUSTERING |
The consumption mode. Valid values:
For more information about the consumption modes, see Clustering consumption and broadcasting consumption. |
ConnectionSet | Array of ConnectionDo |
The information about online consumers in the consumer group. |
|
ConnectionDo | |||
RemoteIP | String | 42.120.74.** |
The private or public IP address of the host. |
Version | String | V4_3_6_SNAPSHOT |
The version of the consumer client. |
ClientAddr | String | 30.5.121.** |
The IP address and port number of the consumer. |
Language | String | JAVA |
The programming language in which the consumer is developed. |
ClientId | String | 30.5.121.**@25560#-1999745829#-1737591554#458773089270275 |
The ID of the consumer. |
TotalDiff | Long | 197 |
The total number of queued messages. |
ConsumerConnectionInfoList | Array of ConsumerConnectionInfoDo |
The details of online consumers in the consumer group, including the information about the thread stack traces and consumption response time (RT). If you want to obtain information that is contained in this parameter, make sure that the Detail parameter in the request is set to true. If the Detail parameter is not set to true, the value of this parameter is empty. |
|
ConsumerConnectionInfoDo | |||
ConsumeModel | String | CLUSTERING |
The consumption mode. Valid values:
For more information about the consumption modes, see Clustering consumption and broadcasting consumption. |
RunningDataList | Array of ConsumerRunningDataDo |
The real-time statistics. |
|
ConsumerRunningDataDo | |||
GroupId | String | 0 |
The ID of the consumer group. |
Rt | Float | 0 |
The consumption RT. Unit: milliseconds. |
Topic | String | test-mq_topic |
The name of the topic to which the consumer subscribes. |
FailedCountPerHour | Long | 0 |
The number of messages that failed to be consumed each hour. |
OkTps | Float | 0 |
The TPS of successful message consumption. |
FailedTps | Float | 0 |
The TPS of failed message consumption. |
SubscriptionSet | Array of SubscriptionData |
The information about subscriptions. |
|
SubscriptionData | |||
SubString | String | * |
The expression that is used to specify the tags of messages in the topic to which the consumer subscribes. |
SubVersion | Long | 1570701364301 |
The version of the subscription relationship. The value is of the LONG type and is automatically incremented. |
Topic | String | test-mq_topic |
The name of the topic to which the consumer subscribes. |
TagsSet | Array of String | ff |
The information about the tags of the topic to which the consumer subscribes. |
Jstack | Array of ThreadTrackDo |
The information about the thread stack traces. If you want to obtain the information about thread stack traces, make sure that the NeedJstack parameter in the request is set to true. If the NeedJstack parameter is not set to true, the value of this parameter is empty. |
|
ThreadTrackDo | |||
TrackList | Array of String | TID: 52 STATE: WAITING |
The details of thread stack traces. |
Thread | String | ConsumeMessageThread_0 |
The name of the thread. |
LastTimeStamp | Long | 1570701368114 |
The most recent point in time when a message was consumed. |
StartTimeStamp | Long | 1570701361528 |
The earliest point in time when a message was consumed. |
Language | String | JAVA |
The programming language in which the consumer is developed. |
ClientId | String | 30.5.**.**@25560#-1999745829#-1737591554#458773089270275 |
The ID of the consumer. |
Connection | String | ** |
The connection information of the consumer. |
Version | String | V4_3_6 |
The version of the consumer client. |
ConsumeType | String | PUSH |
The mode in which the consumer consumes messages. Valid values:
|
ThreadCount | Integer | 20 |
The number of consumer threads. |
InstanceId | String | MQ_INST_111111111111_DOxxxxxx |
The ID of the instance. |
DetailInTopicList | Array of DetailInTopicDo |
The information about message consumption by topic. If you want to obtain information about message consumption, make sure that the Detail parameter in the request is set to true. If the Detail parameter is not set to true, the value of this parameter is empty. |
|
DetailInTopicDo | |||
DelayTime | Long | 0 |
The consumption latency. |
TotalDiff | Long | 0 |
The number of queued messages in the topic. |
LastTimestamp | Long | 1570701259403 |
The most recent point in time when a message was consumed. |
Topic | String | test-mq_topic |
The name of the topic. |
SubscriptionSame | Boolean | true |
Indicates whether all consumers in the consumer group subscribe to the same topics and tags. |
DelayTime | Long | 100857 |
The consumption latency. |
LastTimestamp | Long | 1566883844954 |
The most recent point in time when a message was consumed. |
Online | Boolean | true |
Indicates whether the consumer group is online. |
RebalanceOK | Boolean | true |
Indicates whether load balancing is performed as expected. Valid values:
|
Examples
Sample requests
http(s)://ons.cn-hangzhou.aliyuncs.com/?Action=OnsConsumerStatus
&GroupId=GID_test_group_id
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&NeedJstack=true
&Detail=true
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<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-171235FA****</requestId>
</OnsConsumerStatusResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"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-171235FA****"
}
Error codes
For a list of error codes, visit the API Error Center.
Query details of a consumer group in the console
In the Message Queue for Apache RocketMQ console, you can query the details of a consumer group. For more information, see View the status of consumers.