I’m working with Apache Kafka in Spring Boot application and I’m trying to understand the behavior of a Kafka consumer when it is processing a batch of messages and a rebalance occurs.
Suppose a consumer has fetched a batch of messages and is currently processing them. During this processing, a rebalance event is triggered. I have a question:
What happens to the messages that the consumer is currently processing? Does Kafka allow the consumer to finish processing these messages and committing offset of these messages ?
I want to ensure that my consumers handle rebalances gracefully without losing any messages or processing them twice.
Any detailed explanations or references to Kafka documentation would be greatly appreciated!