Looking for apache-kafka Answers? Try Ask4KnowledgeBase
Looking for apache-kafka Keywords? Try Ask4Keywords

apache-kafka kafka-console-producer


This tool lets you produce messages from the command-line.

Send simple string messages to a topic:

kafka-console-producer --broker-list localhost:9092 --topic test
here is a message
here is another message

(each new line is a new message, type ctrl+D or ctrl+C to stop)

Send messages with keys:

kafka-console-producer --broker-list localhost:9092 --topic test-topic \
        --property parse.key=true \
        --property key.separator=,
key 1, message 1
key 2, message 2
null, message 3

Send messages from a file:

kafka-console-producer --broker-list localhost:9092 --topic test_topic < file.log