卡夫卡控制檯製造商

此工具允許你從命令列生成訊息。

將簡單的字串訊息傳送到主題:

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

(每個新行都是一條新訊息,輸入 ctrl + D 或 ctrl + C 來停止)

使用金鑰傳送訊息:

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
^D

從檔案傳送訊息:

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