Write a few Events into the Topic

After you create a topic, populate the topic with one or more events that you want to stream.

A Kafka client communicates with the Kafka brokers via the network for writing or reading events. Once received, the brokers will store the events in a durable and fault-tolerant manner for as long as you need.

  • You have created a Kafka topic.
  1. Run the console producer client to write a few events into your topic. By default, each line you enter will result in a separate event being written to the topic.
    $ bin/kafka-console-producer.sh --topic quickstart-events --bootstrap-server localhost:9092
    This is my first event
    This is my second event
    You can stop the producer client with Ctrl-C at any time.
  2. Optionally, write more messages to the topic.
    For more Kafka command-line tools, see Kafka Command Line Tools.
Read the events.