In this exercise you will create a consumer group and observe what happens when the number of members changes.
Duration: 30 mins
TIP Use bit.ly/kafka-exercise-admin-06 to access this exercise.
- (optional) Install kafkacat - Apache Kafka producer and consumer tool
kafka-console-producer
does not support sending messages to a given partition)
- Create a topic t1 with 3 partitions
- Start a new consumer c1 in a consumer group CG1
- Send messages to partition 0 and use 0 for the key
- Send messages to partition 2 and use 2 for the key
At this point you should have 3 partitions, 2 producers and 1 consumer. Observe what and how messages are consumed. Simply send messages so you can identity what message used what partition.
- Start a new consumer c2 in the CG1 consumer group
- Observe what messages are consumed by the consumers
- Start a new consumer c3 in the CG1 consumer group
- Observe what messages are consumed by the consumers
- Shut down any of the running consumers
- Observe which consumer takes over the partition