# Create Kafka Producer (from CLI)

Published 2022-12-03

This tutorial explains to you how to create a Kafka producer from CLI. This tutorial has an example as well.

Creating a producer in Kafka from CLI (Command Line Interface) is very simple. You have to run the following command:

kafka-console-producer.sh --topic my-topic10 --bootstrap-server localhost:9092

Here it is an example:

Instead --bootstrap-server you can use --broker-list which is deprecated (and not recommended).

This command has many options. To see the command options you have to run the kafka-console-producer.sh script:

When you create a producer from command line you can enter a message and press "Enter" after it. On my first picture you can see the messages: "10", "20".

Now you can consume the messages as in the picture below.

The consumer can be created before the producer, but the message will be received when the producer will create it.