Kafka comes with a command line client that will take input from a file or from standard input and send it out as messages to the Kafka cluster. By default, each line will be sent as a separate message. Run the producer and then type a few messages into the console to send to the server.
1 2 3 4 5
> bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
This is a message This is another message
Start a consumer
Kafka also has a command line consumer that will dump out messages to standard output.
1 2 3 4 5
> bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
This is a message This is another message
Understand random characters in the log file of kafka