Kafka Consumer Group
A Kafka consumer group is a set of consumer instances that collectively read from a topic, with each partition assigned to exactly one consumer in the group at any given time.
A Kafka consumer group is a set of consumer instances that collectively read from a topic, with each partition assigned to exactly one consumer in the group at any given time.
Consumer groups are Kafka's built-in mechanism for parallel, fault-tolerant message processing. When a topic has multiple partitions, Kafka distributes those partitions across the active consumers in a group, enabling horizontal scaling without duplicating messages. The key constraint is that a single partition can only be owned by one consumer within a group — this is what guarantees that messages within a partition are processed in order.
The assignment is managed by a Group Coordinator (a designated broker) and a Group Leader (the first consumer to join). When a consumer joins or leaves, Kafka triggers a rebalance: the group leader collects the current partition list and membership, computes a new assignment using the configured partition.assignor strategy (range, round-robin, sticky, or cooperative sticky), and distributes it via the coordinator. During a rebalance, consumption pauses — so minimizing rebalances (by using sticky assignors and heartbeat tuning) matters for latency-sensitive workloads.
This diagram shows a topic with four partitions assigned to three consumers. Consumer A handles two partitions while B and C each handle one. If Consumer A crashes, a rebalance redistributes its partitions to the remaining healthy consumers. This is why the Kafka Producer Consumer Flow includes offset commits — they allow a replacement consumer to resume exactly where the failed one left off.
Multiple independent consumer groups can read the same topic simultaneously without interfering with each other, since each group maintains its own set of offsets. This is how Fan Out Messaging patterns are commonly implemented in Kafka-based architectures.