You can call this operation to reset the consumer offset of a specified group ID to a specified timestamp.

The operation is used to clear accumulated messages or trace back consumption. You can clear accumulated messages in the following ways:

  • Clear all accumulated messages.
  • Reset the consumer offset to a specified time.


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 OnsConsumerResetOffset

The operation that you want to perform. Set the value to OnsConsumerResetOffset.

GroupId String Yes GID_test_consumer_id

The consumer group ID whose consumer offset needs to be reset.

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 name of the topic for which you want to reset the offset.

Type Integer Yes 1

The type of message clearance. Valid values:

  • 0: clears all messages. When consuming messages in this topic, consumers corresponding to the group ID skip all the accumulated (unconsumed) messages and start to consume from the latest message sent.

    However, if the program returns "reconsumeLater", this indicates that the relevant messages are in the retry process and cannot be skipped.

  • 1: clears messages sent before a specified time. Only the messages sent after the specified time are consumed.

    The time range allowed for selection ranges from the production time of the earliest message stored in the topic to that of the latest message stored in the topic. You can only select a time within the allowed time range.

ResetTimestamp Long No 1568033253

The timestamp to which you want to reset the consumer offset. This parameter only takes effect when Type is 1.

Response parameters

Parameter Type Example Description
RequestId String D52C68F8-EC5D-4294-BFFF-1A6A25AFBE54

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


Sample requests

http(s)://[Endpoint]/? Action=OnsConsumerResetOffset
&<Common request parameters>

Sample success responses

XML format


JSON format

	"RequestId": "D52C68F8-EC5D-4294-BFFF-1A6A25AFBE54"