# Create Kafka Consumer (from CLI)

In 
Published 2022-12-03

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

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

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

Here it is an example:

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

In the picture below you can see how to produce the messages. When you create a producer from command line you can enter a message and press "Enter" after it. On the picture below you can see the messages: "10", "20".

The consumer can be created before the producer or after but the message will be received when the producer will create it. Some consumers could read the messages received by the topic before consumer creation.