Say I have consumer group G1 which has three consumers C1,C2 and C3. All subscribe to Topic 1 which has single partition. Now Producer produces 3 messages on partition1, broker will handover 1 message to each consumer. Right ?
But I got confused after reading below bold text from section Workflow of Queue Messaging / Consumer Group
at kafka tutorial
- A single consumer subscribes to a specific topic, assume "Topic-01" with "Group ID” as “Group-1”.
- Kafka interacts with the consumer in the same way as Pub-Sub Messaging until new consumer subscribes the same topic, "Topic-01" with the same “Group ID” as “Group-1”.
- Once the new consumer arrives, Kafka switches its operation to share mode and shares the data between the two consumers. This sharing will go on until the number of consumers reach the number of partition configured for that particular topic.
- Once the number of consumer exceeds the number of partitions, the new consumer will not receive any further message until any one of the existing consumer unsubscribes. This scenario arises because each consumer in Kafka will be assigned a minimum of one partition and once all the partitions are assigned to the existing consumers, the new consumers will have to wait.
If i go by point 3/4, will only consumer1 will get all messages as number of consumer (which is 3) is greater than no of partition(which is 1) ? Does it mean i need to create 3 partitions in all and group G1 will subscribe with all 3 partitions so that each consumer gets one message each ?