Consumer Group Vs Partition
Each consumer group will read 1 partition.
So if you have 2 consumers in 2 different consumer groups, they will both read the same messages from Kafka
In order for 2 consumers interchangely consume the message, you need to put them in the same partition.
Example:
- So for example you have a topic
mytopic
with 12 partition. You put 2 consumers in the same consumer group:- Each consumer will consume 6 partitions
- You have a topic
mytopic
with 12 partition. You put 2 consumers in 2 different consumers group:- Each consumer will consume 12 partitions (duplication)