Congratulations, you're a rock star ! Let's finally learn how to consume from a topic and particular partition.
What is the Consumer?
The consumer is the other side of the road, where services and applications can subscribe to a Topic and start consuming messages from them.
Few characteristics about the consumers:
It works with subscription against 1+ topic
It use a pull request method against the brokers
Keeps a record of the offset that it reads from
Responsible for the offset commit
It attach itself to a Consumer Group
Now let's see how we can consume the messages we have been producing from the other side.
But, before that take a look to the kafka-console-consumer.sh script and its options. Looking at the usage scripts is helpful and save you a lot of time when you are starting to play with it.
Kafka Console Consumer Help
./kafka-console-consumer.sh
Consume messages
Use the Kafka console consumer to Consume from the topic you send messages to in the previous section.
Try to consume the first 3 messages that arrived from the very beginning to the topic
Extra:
If you completed the exercise about sending messages with a Key:
Consume the messages and try to print the key too :)
If you have +1 partitions in any of your topics , go ahead and generate 3 messages with different key for each and try to consume them add see what happens :)