You can reset a consumer offset to change the offset from which a consumer starts to consume messages. You can reset a consumer offset to clear the accumulated or unwanted messages as needed or skip to a specified point in time to start to consume messages from the specified point in time.
ConsumerConfig.SESSION_TIMEOUT_MS_CONFIGparameter elapses. The default value of this parameter is 10,000 ms.
Message Queue for Apache Kafka allows you to reset consumer offsets in one of the following ways:
- Clear messages: If a consumer no longer wants to consume accumulated messages on the broker, you can choose to clear messages for the consumer. This way, the consumer offset for the consumer is set to the latest offset.
Notice Accumulated messages are not deleted. Only the consumer offset is changed.
- Start consumption at a specified point in time: You can reset the offset of a consumer group to a point in time "t" that is in the past or future. The point in time "t" is a point in time when a message is stored. Then, the consumer group subscribes to messages stored after "t".
- Log on to the Message Queue for Apache Kafka console.
- In the Resource Distribution section of the Overview page, select the region where your instance resides.
- On the Instances page, click the name of the instance that you want to manage.
- In the left-side navigation pane, click Groups.
- On the Groups page, find the consumer group for which you want to reset consumer offsets, click More in the Actions column, and then select Reset Consumer Offset.
- In the Reset Consumer Offset of Group panel, understand its Prerequisites and configure the reset policy.
- Set Reset All Topics.
- Select Yes to reset consumer offsets for all topics.
- Select No and enter the name of the topic for which you want to reset the consumer offset in the Topic field.
- Set Reset Method.
- Select Reset Consumer Offset to Latest Offset to reset the consumer offset to the latest offset. Then, click OK.
- Click Reset Consumer Offset to Offset at Specified Point in Time. In the Point in Time field that appears, click . In the time picker that appears, select a specific point in time to start to consume messages from this point in time. Then, click OK.
- Set Reset All Topics.
- In the Note message, read the note. If you are sure to reset the consumer offset, click OK.