Queries the message accumulation information of topics to which a specified group ID has subscribed, including the current number of accumulated messages and the consumption latency.
Usage notes
The message accumulation information is typically queried when you need to know the consumption progress of a specified group ID in the production environment to roughly determine the message consumption status and latency. You can check not only the message accumulation information of all topics to which the specified group ID has subscribed, but also the message accumulation information of each topic.
QPS limit
The queries-per-second (QPS) limit on this operation is 10 per user. Throttling is triggered when the number of calls to this operation per second exceeds the QPS limit. Throttling may affect your business. Therefore, call this operation based on your needs. For more information, see QPS limits.
Authorization information
By default, only Alibaba Cloud accounts can call this operation. RAM users can call this operation only after they are authorized to use it. The following table lists the authorization information of this operation. For more information, see Policies and examples.
API |
Action |
Resource with a namespace |
Resource without a namespace |
---|---|---|---|
OnsConsumerAccumulate |
mq:QueryConsumerAccumulate |
acs:mq:*:*:{instanceId}%{groupId} |
acs:mq:*:*:{groupId} |
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | OnsConsumerAccumulate |
The operation that you want to perform. Set the value to OnsConsumerAccumulate. |
GroupId | String | Yes | GID_test_consumer_id |
The consumer group ID that you want to query. |
InstanceId | String | Yes | MQ_INST_111111111111_DOxxxxxx |
The ID of the instance. |
Detail | Boolean | No | true |
Specifies whether to query the details about each topic to which the group ID has subscribed. Valid values:
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Data | Struct |
The message accumulation information of topics to which the specified consumer has subscribed. |
|
ConsumeTps | Float | 10 |
The total transactions per second (TPS) for messages received by the consumer instance group that corresponds to the group ID. |
DelayTime | Long | 10000 |
The consumption latency. |
DetailInTopicList | Array of DetailInTopicDo |
The details about each subscribed topic. If the Detail parameter in the request is set to false, the returned value of this parameter is empty. |
|
DetailInTopicDo | |||
DelayTime | Long | 10000 |
The maximum consumption latency of messages in the topic. |
LastTimestamp | Long | 1566231000000 |
The time when the latest consumed message in the topic was produced. |
Topic | String | test-mq-topic |
The name of the topic. |
TotalDiff | Long | 100 |
The number of accumulated messages in the topic. |
LastTimestamp | Long | 1566231000000 |
The time when the latest message consumed by the consumer instance group of the group ID was produced. |
Online | Boolean | true |
Indicates whether consumer instances of the group ID are online. The group ID is online if one of its consumer instances is online. Valid values:
|
TotalDiff | Long | 100 |
The total number of accumulated messages in all the topics to which the group ID has subscribed. |
RequestId | String | CE817BFF-B389-43CD-9419-95011AC9**** |
The ID of the request, which is a common parameter. Each request has a unique ID to facilitate troubleshooting and fault locating. |
Examples
Sample requests
http(s)://ons.cn-hangzhou.aliyuncs.com/? Action=OnsConsumerAccumulate
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&GroupId=GID_test_consumer_id
&Detail=true
&<Common request parameters>
Sample success responses
XML
format
<OnsConsumerAccumulateResponse>
<Data>
<DetailInTopicList>
<DetailInTopicDo>
<TotalDiff>100</TotalDiff>
<LastTimestamp>1566231000000</LastTimestamp>
<DelayTime>10000</DelayTime>
<Topic>test-mq-topic</Topic>
</DetailInTopicDo>
</DetailInTopicList>
<TotalDiff>100</TotalDiff>
<LastTimestamp>1566231000000</LastTimestamp>
<DelayTime>10000</DelayTime>
<Online>true</Online>
<ConsumeTps>10</ConsumeTps>
</Data>
<RequestId>0CCF6437-CBB0-4378-BFEC-E08AC258****</RequestId>
</OnsConsumerAccumulateResponse>
JSON
format
{
"Data": {
"DetailInTopicList": {
"DetailInTopicDo": [
{
"TotalDiff": 100,
"LastTimestamp": 1566231000000,
"DelayTime": 10000,
"Topic": "test-mq-topic"
}
]
},
"TotalDiff": 100,
"LastTimestamp": 1566231000000,
"DelayTime": 10000,
"Online": true,
"ConsumeTps": 10
},
"RequestId": "0CCF6437-CBB0-4378-BFEC-E08AC258****"
}
Error codes
For a list of error codes, visit the API Error Center.
Operations in the console
In addition to calling the OnsConsumerAccumulate operation, you can query the message accumulation information of all topics to which a specified group ID has subscribed in the Message Queue for Apache RocketMQ console. For more information, see View the status of consumers.