Overview
You can manually change the position in a Apache Kafka topic partition from which a consumer group processes messages by resetting the offset. A reset typically moves the offset to an earlier position, such as the beginning of a topic, so that the connector reprocesses messages from that point forward. You can also move the offset to a later position to skip messages.
Resetting a Source Connector Offset
The MongoDB Kafka source connector provides a way to reset offsets by using
the offset.partition.name configuration property. To learn more,
see Reset Stored Offsets.
Resetting a Sink Connector Offset
MongoDB does not support resetting offsets for the MongoDB Kafka sink connector. However, you can reset the offsets of the consumer group associated with your sink connector by using the Apache Kafka consumer group tool.
To learn more, see the Kafka consumer group tool page in the Confluent documentation.
Considerations
Before you reset your MongoDB Kafka source connector or MongoDB Kafka sink connector offsets, consider the following:
Resetting offsets can result in data inconsistency or data loss, as messages can be skipped or reprocessed. Use this procedure carefully.
The commands in this procedure operate on Apache Kafka only, not on your MongoDB deployment. Required steps may vary between providers and configurations. Review your Kafka provider's documentation and confirm with your provider or administrator that this procedure is appropriate for your environment.