OnCallReadyStart learning

kafka-console-producer.sh: read data from standard input and publish it to Kafka

kafka-console-producer.sh [options]

Options you will use

--bootstrap-server <String: server to connect to>
REQUIRED: the Kafka broker(s) to connect to, host:port[,host:port]. Give more than one: the first may be the broker that is down.
--topic <String: topic>
REQUIRED: the topic to produce to.
--request-required-acks <String>
the acks setting: -1/all (default), 1, 0.
--reader-property <String: prop>
line reader settings: parse.key=true, key.separator=: (default TAB), null.marker, parse.headers.
--command-property <String: prop>
any producer config (producer-property is deprecated since 4.2).
--command-config <String: file>
producer configs from a file.
--compression-codec [String]
none, gzip, snappy, lz4 or zstd.
--sync
send synchronously, one record at a time.

Examples

$ echo hello | kafka-console-producer.sh --bootstrap-server kafka-1:9092 --topic notifications

one record

$ printf 'k1:v1\n' | kafka-console-producer.sh --bootstrap-server kafka-1:9092 --topic t --reader-property parse.key=true --reader-property key.separator=:

a keyed record

Gotchas

On the blog

Try kafka-console-producer.sh in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.