Scenario
In RocketMQ, offset resetting is a common method to set the consumer's consumption position in a message queue. The following shows the common scenarios of offset resetting in RocketMQ:
l Restart after an abnormal stop of the consumer: When a consumer stops the consumption abnormally for some reasons, the consumer offset may require a reset upon restart. For example, a consumer encounters a problem while processing a message, and the consumption stops. After restarting, the consumption can continue from the last consumption position, or re-consume from the earliest message.
l A consumption progress error or reprocessing: In some cases, an error occurs in the consumer's consumption progress. You need to reprocess messages that were not processed correctly. At this point, you can reset the consumer offset to the specified position to re-consume or re-process the message.
l Switching consumption modes: When a consumer switches between the cluster mode and the broadcasting mode, the consumer offset may require a reset. In different consumption modes, consumers have different ways to manage the consumer offset and progress of message queues.
l Slow consumption: When a consumer consumes messages too slowly, messages may be accumulated. At this point, you can reset the consumer offset to the latest position to quickly consume the accumulated messages.
You need to pay attention to the following points before resetting the consumer offset:
l Determine the target position for the reset. You can choose to start consumption from the earliest message position or from the specified message position.
l Be cautious to perform the reset. Back up the associated data to prevent data loss or misoperations.
l Evaluate the impact of the reset on consumer groups and message modes. Different consumer groups and message modes may have different requirements and restrictions on consumer offset reset.
To sum up, consumer offset reset is a common operation for handling cases where the consumer stops consumption abnormally, the consumption progress is incorrect, or a message needs to be reprocessed. You need to carefully evaluate and handle it to ensure that business and data are not irreversibly affected by the reset.
Procedure
1. On the eSurfing Cloud official website, click Control Center and select RocketMQ.
2. Log in to the DMS RocketMQ console and click Region in the upper right corner to select the corresponding resource pool.
Go to the instance list and click Manage to enter the management menu.
3. Go to the instance list and click Manage to enter the management menu.
4. Go to the topic management menu. Click Reset Offset. In the pop-up window, select the name of the consumer group.
5. Select the reset time and click OK to reset the consumer offset.
Note: When the consumer offset is reset to the historical time point T1, messages produced before T1 become consumed messages, and messages produced after T1 become unconsumed messages. If the consumer offset is reset to future time point T2, all existing messages will become consumed messages.
Note:
l Reset time: Refers to the time when a message is produced.
l No time selected: All messages become unconsumed ones.
l Future time: All messages become consumed ones.
l A certain time point: Messages become consumed before this point in time and become unconsumed when the time is changed.
l The consumer client must be closed for the v1 consumption mode.