Resets the consumption offset of consumers with a specified group ID to a specified timestamp.
The operation is used to clear accumulated messages or trace back consumption. The following two ways can help you clear accumulated messages:
- Clear all messages.
- Clear messages sent before a specified time.
Debugging
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 message clearing type. Valid values:
|
ResetTimestamp | Long | No | 1591153871000 |
The timestamp to which you want to reset the consumer offset. It takes effect only when the Type parameter is set to1. Unit: milliseconds. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | D52C68F8-EC5D-4294-BFFF-1A6A25AFBE54 |
The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/? Action=OnsConsumerResetOffset
&GroupId=GID_test_consumer_id
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&Topic=test-mq-topic
&Type=1
&ResetTimestamp=1591153871000
&<Common request parameters>
Sample success responses
XML
format
<OnsConsumerResetOffsetResponse>
<RequestId>D52C68F8-EC5D-4294-BFFF-1A6A25AFBE54</RequestId>
</OnsConsumerResetOffsetResponse>
JSON
format
{
"RequestId": "D52C68F8-EC5D-4294-BFFF-1A6A25AFBE54"
}
Error codes
For a list of error codes, visit the API Error Center.