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.

Prerequisites

All consumers are stopped. Message Queue for Apache Kafka does not allow you to reset offsets of online consumers.
Notice After a consumer is stopped, the Message Queue for Apache Kafka broker determines that the consumer has been stopped after the period of time specified by the ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG parameter elapses. The default value of this parameter is 10,000 ms.

Background information

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".

Procedure

  1. Log on to the Message Queue for Apache Kafka console.
  2. In the Resource Distribution section of the Overview page, select the region where your instance resides.
  3. On the Instances page, click the name of the instance that you want to manage.
  4. In the left-side navigation pane, click Groups.
  5. 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.
  6. In the Reset Consumer Offset of Group panel, understand its Prerequisites and configure the reset policy.
    1. 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.
    2. 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 time. 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.
  7. In the Note message, read the note. If you are sure to reset the consumer offset, click OK.