
# 重置消费组消费进度到指定位置
#### 功能介绍
Kafka实例不支持在线重置消费进度。在执行重置消费进度之前，必须停止被重置消费组客户端。停止待重置消费组客户端，然后等待一段时间（即ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG配置的时间，默认为1000毫秒）后，服务端才认为此消费组客户端已下线。
![](https://support.huaweicloud.com/api-kafka/public_sys-resources/note_3.0-zh-cn.png)
当前页面API为历史版本API，未来可能停止维护。请使用[重置消费组消费进度到指定位置](https://support.huaweicloud.com/api-kafka/ResetMessageOffsetWithEngine.html)。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-kafka/api-call-process.html)。
#### URI
POST /v2/{project_id}/instances/{instance_id}/management/groups/{group}/reset-message-offset
表1路径参数 
| 参数          | 是否必选 | 参数类型   | 描述                                                                                         |
|:---|:---|:---|:---|
| project_id  | 是    | String | 项目ID，获取方式请参见[获取项目ID](https://support.huaweicloud.com/api-kafka/kafka-api-0036212547.html)。 |
| instance_id | 是    | String | 实例ID。                                                                                      |
| group       | 是    | String | 消费组名称。                                                                                     |
   
#### 请求参数
表2请求Body参数 
| 参数             | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|:---|
| topic          | 否    | String  | topic名称。                                                                                                                                                                                                                                                                                                                                                                                      |
| partition      | 是    | Integer | 分区编号，默认值为-1，若传入值为-1，则重置所有分区。                                                                                                                                                                                                                                                                                                                                                                  |
| message_offset | 否    | Long    | 重置消费进度到指定偏移量。 - 如果传入offset小于当前最小的offset，则重置到最小的offset。  - 如果大于最大的offset，则重置到最大的offset。   **message_offset、timestamp二者必选其一。**                                   |
| timestamp      | 否    | Long    | 重置消费进度到指定时间，格式为unix时间戳，单位为毫秒。 - 如果传入timestamp早于当前最早的timestamp，则重置到最早的timestamp。  - 如果晚于最晚的timestamp，则重置到最晚的timestamp。   **message_offset、timestamp二者必选其一。** |
   
#### 响应参数
无
#### 请求示例
- 重置的消费进度到指定偏移量。
  ```
  POST https://{endpoint}/v2/{project_id}/instances/{instance_id}/management/groups/{group}/reset-message-offset
  {
    "topic" : "test",
    "partition" : 0,
    "message_offset" : 10
  }
  ```
  
- 重置的消费进度到指定时间。
  ```
  POST https://{endpoint}/v2/{project_id}/instances/{instance_id}/management/groups/{group}/reset-message-offset
  {
    "topic" : "test",
    "partition" : 0,
    "timestamp" : 1571812144000
  }
  ```
  
 
#### 响应示例
无
#### 状态码
| 状态码 | 描述                  |
|:---|:---|
| 204 | 重置消费组消息进度到指定位置操作成功。 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-kafka/ErrorCode.html)。
