If you reset a consumer offset, the offset from which a consumer starts to consume messages is changed. You can reset a consumer offset to clear the accumulated or unwanted messages as needed or start to consume messages from a specific point in time.

Prerequisites

All consumers are stopped. Message Queue for Apache Kafka does not allow you to reset the consumer offsets for online consumers.
Notice After you stop a consumer, the Message Queue for Apache Kafka broker considers the consumer stopped after the period of time specified by the ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG parameter elapses. The default value of this parameter is 10000, in milliseconds.

Background information

Message Queue for Apache Kafka allows you to reset consumer offsets in one of the following ways:

  • Clear messages: If you no longer want to consume accumulated messages on the broker, you can clear messages for the consumer. This way, the consumer offset 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 consumer offset of a group to a point in time "t" that is in the past or future. "t" indicates a point in time when a message is stored. Then, the group starts to consume messages stored after "t".
  • Start consumption at a specified offset in a partition: You can reset the consumer offset of a group to "3" in partition "1". "1" indicates a partition of the topic to which the group subscribes. "3" indicates the offset of a message in the partition. Then, the group starts to consume messages from offset "3" in partition "1".

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 group for which you want to reset the consumer offset, click More in the Actions column, and then select Reset Consumer Offset.
  6. In the Reset Consumer Offset of Group panel that appears, read the prerequisites and configure the reset policy.Prerequisites
    1. Set the Reset All Topics parameter.
      • Select Yes to reset the consumer offset for each topic.
      • Select No and enter the name of the topic for which you want to reset the consumer offset in the Topic field.
    2. Set the Reset Method parameter.
      • Select Reset Consumer Offset to Latest Offset to reset the consumer offset to the latest offset. Then, click OK.
      • Select Reset Consumer Offset to Offset at Specified Point in Time. In the Point in Time field, click the Calendar icon. In the date and time picker that appears, specify a point in time from which you want the group to consume messages. Then, click OK.
      • Select Reset Consumer Offsets by Partition. In the Consumer Offset field, find a partition, enter an integer in the field next to the partition as the offset from which you want the group to consume messages, and then click OK.
  7. In the Note message, read the note. If you are sure to reset the consumer offset, click OK.