Queries the time range within which you can specify a point in time to reset the consumer offset for a specified topic. The time range is from the earliest point in time when a message was published to the topic to the most recent point in time when a message was published to the topic.
Note
You can call this operation to query the earliest point in time when a message was published to a specified topic and the most recent point in time when a message was published to the specified topic. You can also obtain the most recent point in time when a message in the topic was consumed. You can call this operation and the OnsConsumerAccumulate operation to obtain the information about the message consumption progress of a consumer group.
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 |
---|---|---|---|
OnsConsumerTimeSpan |
mq:QueryInstanceBaseInfo mq:QueryConsumerTimeSpan |
acs:mq:*:*:{instanceId}%{topic} |
acs:mq:*:*:{topic} |
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | OnsConsumerTimeSpan |
The operation that you want to perform. Set the value to OnsConsumerTimeSpan. |
GroupId | String | Yes | GID_test_group_id |
The ID of the consumer group that you want to query. |
Topic | String | Yes | test-mq_topic |
The topic to which the consumer group subscribes. |
InstanceId | String | Yes | MQ_INST_111111111111_DOxxxxxx |
The ID of the Message Queue for Apache RocketMQ instance to which the consumer group belongs. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | A07E3902-B92E-44A6-B6C5-6AA111111**** |
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. |
|
MaxTimeStamp | Long | 1570761026804 |
The earliest point in time when a message was published to the topic. |
ConsumeTimeStamp | Long | 1570761026400 |
The most recent point in time when a message in the topic was consumed. |
Topic | String | test-mq_topic |
The name of the topic. |
MinTimeStamp | Long | 1570701231122 |
The most recent point in time when a message was published to the topic. |
InstanceId | String | MQ_INST_111111111111_DOxxxxxx |
The ID of the Message Queue for Apache RocketMQ instance to which the consumer group belongs. |
Examples
Sample requests
http(s)://ons.cn-hangzhou.aliyuncs.com/?Action=OnsConsumerTimeSpan
&GroupId=GID_test_group_id
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&Topic=test-mq_topic
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<OnsConsumerTimeSpanResponse>
<Data>
<MinTimeStamp>1570701231122</MinTimeStamp>
<ConsumeTimeStamp>1570761026400</ConsumeTimeStamp>
<InstanceId>MQ_INST_111111111111_DOxxxxxx</InstanceId>
<Topic>test-mq_topic</Topic>
<MaxTimeStamp>1570761026804</MaxTimeStamp>
</Data>
<RequestId>A07E3902-B92E-44A6-B6C5-6AA111111****</RequestId>
</OnsConsumerTimeSpanResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Data" : {
"MinTimeStamp" : 1570701231122,
"ConsumeTimeStamp" : 1570761026400,
"InstanceId" : "MQ_INST_111111111111_DOxxxxxx",
"Topic" : "test-mq_topic",
"MaxTimeStamp" : 1570761026804
},
"RequestId" : "A07E3902-B92E-44A6-B6C5-6AA111111****"
}
Error codes
For a list of error codes, visit the API Error Center.