📥Kafka Consumer
Also known as Consumer (Kafka), Kafka Consumer Client
A program that reads events from Kafka in order. An offset marks its place.
Think of it like
It is like reading a long book with a bookmark. You stop, and later you go on where you left off.
Example
Two apps read the orders topic: one loads the warehouse and one sends emails. Each has its own group, so each gets every order.
Why it matters
Reading does not delete, so a new app can replay old events. That is how a new report gets its history.
Definition
Example code
console
$ bin/kafka-console-consumer.sh --topic orders --from-beginning --bootstrap-server localhost:9092
order 1001 placed
order 1002 placedCommon mistake
Key takeaways
- 1In order. Per partition, oldest first.
- 2Keeps its place. The offset is its bookmark.
- 3Reads, never deletes. Others can read the same events.