Using the following command line, you can get the Producer to send messages -
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic topic-name
You will need to input two parameters here - Broker list or the list of brokers we want to send messages to and the Topic name.
For example, if your broker is on port id - 5467, you can mention it directly.
Therefore, the resulting syntax will look like -
bin/kafka-console-producer.sh --broker-list localhost:5467 --topic Hello-Kafka
The producer will publish this to the Kafka cluster and every line will be published as a new message by default until it is specified otherwise in the ‘config/producer.properties’ file.