Read the Events
Consumers are client applications that subscribe to read and process events. You can simulate the subscription process by running the console consumer client to read the events you just created.
Events in a topic can be read as often as needed and by as many consumers as necessary. Events are not deleted after consumption.
- You have a topic with events in it.
Open another terminal session and run the console consumer client to read the
events you just created:
$ bin/kafka-console-consumer.sh --topic quickstart-events --from-beginning --bootstrap-server localhost:9092 This is my first event This is my second event
You can stop the consumer client with
Ctrl-Cat any time.
Feel free to experiment: for example, switch back to your producer terminal
(previous step) to write additional events, and see how the events immediately
show up in your consumer terminal.
For more Kafka command-line tools, see Kafka Command Line Tools.