I understand that Kafka semantics is that a consumer group must read a record only once. To achieve this, Kafka consumers maintain an offset, which is then conveyed to brokers with read requests so that brokers can send data accordingly to ensure that already read data is not resend(). But how does broker and consumers react when their is a change in consumer group, like addition of a new consumer or an existing consumer going down?
There are few things which needs to be considered here.
- A consumer goes down, then how is its offset information taken into account while assigning its partitions to active consumers?
- A new consumer joins, then how does system ensures that it doesn't read a data its consumer group has already read?