You can reset a consumer offset to change the current consumption position of a consumer. You can reset the consumer offset to skip the accumulated or undesired messages instead of consuming them, or to consume messages after a certain time point regardless of whether the messages before this time point have been consumed.
ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG(10,000 ms by default), and then determines that the consumer has been stopped.
Message Queue for Apache Kafka supports the following modes of consumer offset resetting:
- Clear messages: If the subscriber does not want to consume accumulated messages on
the broker anymore, the subscriber can clear messages and specify the consumption
offset to the latest position.
Notice Accumulated messages are not deleted. Only the consumer offset is changed.
- Start consumption at the specified time point: You can reset the offset of a consumer group to a time point "t" in the past or future, that is, a time point when a message is stored. After the reset, the consumer group subscribes to messages stored after "t".
- Log on to the Message Queue for Apache Kafka console.
- In the top navigation bar, select the region where the target instance is located.
- In the left-side navigation pane, click Consumer Groups.
- On the top of the Consumer Groups page, click the target instance, find the target consumer group, and then click Reset Consumer Offset in the Actionscolumn.
- In the Reset Consumer Offset dialog box, select the topic from the Topics drop-down list, select a resetting policy, and then click OK.
Message Queue for Apache Kafka supports the following resetting policies:
- Clear all accumulated messages and consume messages from the latest offset.: corresponds to the message clearing function described at the beginning of this topic.
- Reset Consumer Offset by Time: corresponds to the function of starting consumption at the specified time point described at the beginning of this topic. If you select this policy, you need to specify the time point.