I don't know if there has been some changes in the newer versions of Kafka but the exercise to demonstrate the messages being read from a random consumer in a consumer group in case of multiple partitions doesn't work for me.
Reproducer
I have launched kafka with KRaft as explained in the video.
I created 1 topic with 3 partitions and opened 3 consumers in the same group:
kafka-topics.sh --bootstrap-server localhost:9092 --create --topic my_topic --partitions 3
Then opened 1 producer and 3 consumers like this:
kafka-console-producer.sh --bootstrap-server localhost:9092 --topic my_topickafka-console-consumer.sh --bootstrap-server localhost:9092 --topic my_topic --group uat * 3 times
only 1 of the consumers receive the messages.
System Specifications
WSL2 Ubuntu
kafka_2.13-3.4.0
openjdk 17.0.6 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)
UPDATE: I have tried to launch kafka with zookeeper and the very first message ended up in one consumer while all the other ones in another.
Maybe the default method to split the messages in the partitions have changed?
Hello,
I don't know if there has been some changes in the newer versions of Kafka but the exercise to demonstrate the messages being read from a random consumer in a consumer group in case of multiple partitions doesn't work for me.
Reproducer I have launched kafka with KRaft as explained in the video. I created 1 topic with 3 partitions and opened 3 consumers in the same group:
kafka-topics.sh --bootstrap-server localhost:9092 --create --topic my_topic --partitions 3
Then opened 1 producer and 3 consumers like this:
kafka-console-producer.sh --bootstrap-server localhost:9092 --topic my_topic
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic my_topic --group uat
* 3 timesonly 1 of the consumers receive the messages.
System Specifications WSL2 Ubuntu kafka_2.13-3.4.0 openjdk 17.0.6 2023-01-17 OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10) OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)
UPDATE: I have tried to launch kafka with zookeeper and the very first message ended up in one consumer while all the other ones in another.
Maybe the default method to split the messages in the partitions have changed?