Queries the time range that can be reset for a topic to which a specified consumer group ID has subscribed. The time range is from the time when the earliest message stored in the topic was produced to the time when the latest message stored in the topic was produced.

Usage notes

You can call this operation to query the latest time and the earliest time when messages in a topic are stored on the current Message Queue for Apache RocketMQ broker and query the time when the topic is last consumed by a consumer. This operation is typically used with the OnsConsumerAccumulate operation to display an overview of the consumption progress.

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.



Resource with a namespace

Resource without a namespace





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 consumer group ID that you want to query.

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the instance where the consumer group ID you want to query is located.

Topic String Yes test-mq_topic

The topic to which the consumer group ID has subscribed.

Response parameters

Parameter Type Example Description
Data Struct

The returned query results.

ConsumeTimeStamp Long 1570761026400

The latest time when the consumer group ID consumes a message in the topic.

InstanceId String MQ_INST_111111111111_DOxxxxxx

The ID of the instance that the queried consumer group ID is located.

MaxTimeStamp Long 1570761026804

The time when the earliest message stored in the topic was produced.

MinTimeStamp Long 1570701231122

The time when the latest message stored in the topic was produced.

Topic String test-mq_topic

The name of the queried topic.

RequestId String A07E3902-B92E-44A6-B6C5-6AA111111****

The ID of the request, which is a common parameter. Each request has a unique ID to facilitate troubleshooting and fault locating.


Sample requests

http(s)://ons.cn-hangzhou.aliyuncs.com/? Action=OnsConsumerTimeSpan
&<Common request parameters>

Sample success responses

XML format


JSON format


Error codes

For a list of error codes, visit the API Error Center.