Is there an exception thrown somewhere when kafka max.poll.interval.ms is reached and rebalance happens?
Is there an exception thrown somewhere when kafka max.poll.interval.ms is reached and rebalance happens?
Once your consumer gets kicked out of the consumer group due to long poll(), you will receive a CommitFailedException. According to the documentation:
It is also possible that the consumer could encounter a "livelock" situation where it is continuing to send heartbeats, but no progress is being made. To prevent the consumer from holding onto its partitions indefinitely in this case, we provide a liveness detection mechanism using the
max.poll.interval.mssetting. Basically if you don't call poll at least as frequently as the configured max interval, then the client will proactively leave the group so that another consumer can take over its partitions. When this happens, you may see an offset commit failure (as indicated by aCommitFailedExceptionthrown from a call tocommitSync()). This is a safety mechanism which guarantees that only active members of the group are able to commit offsets. So to stay in the group, you must continue to call poll.
Therefore, you could possibly catch CommitFailedException. Actually, you can keep calling poll() until re-balancing is complete and your consumer re-enters the consumer group.