A producer sends messages to a topic with 12 partitions. You have 4 consumers in a consumer group. How are partitions assigned, and what happens if a consumer dies?
Each consumer gets 3 partitions (12 / 4). When a consumer dies, a rebalance is triggered. The remaining 3 consumers split 12 partitions: two get 4 and one gets 4 (round-robin or range assignment). During rebalance, consumption pauses briefly. A strong answer mentions the rebalance protocol (eager vs cooperative), partition assignment strategies (range, round-robin, sticky), and the impact of session.timeout.ms and heartbeat.interval.ms on detection speed.