You can call this operation to query the time range that can be reset for a topic to which a specified group ID has subscribed. The time range starts from the production time of the earliest message stored in the topic to that of the latest message stored in the topic.

This operation allows you to query the latest time and the earliest time when messages in a topic are stored in the Message Queue for Apache RocketMQ broker and query the time when the topic is last consumed by a consumer. This operation is usually used with the OnsConsumerAccumulate operation to display the overview of the consumption progress.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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 Message Queue for Apache RocketMQ instance corresponding to the consumer group ID.

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 queried consumer group consumes any message in the queried topic.

InstanceId String MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance corresponding to the queried consumer group ID.

MaxTimeStamp Long 1570761026804

The production time of the earliest message stored in the topic.

MinTimeStamp Long 1570701231122

The production time of the latest message stored in the topic.

Topic String test-mq_topic

The name of the topic queried.

RequestId String A07E3902-B92E-44A6-B6C5-6AA1111111799

The ID of the request. This is a common parameter.

Examples

Sample requests

http(s)://[Endpoint]/? Action=OnsConsumerTimeSpan
&GroupId=GID_test_group_id
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&Topic=test-mq_topic
&<Common request parameters>

Sample success responses

XML format

<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-6AA1111111799</RequestId>
</OnsConsumerTimeSpanResponse>

JSON format

{ 
    "Data":{
        "MinTimeStamp":1570701231122,
        "ConsumeTimeStamp":1570761026400,
        "InstanceId":"MQ_INST_111111111111_DOxxxxxx",
        "Topic":"test-mq_topic",
        "MaxTimeStamp":1570761026804
    },
    "RequestId":"A07E3902-B92E-44A6-B6C5-6AA1111111799"
}

Error codes

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