Kafka - kafka-avro-console-producer utility

> Data Integration Tool (ETL/ELT) > Kafka (Event Hub)

1 - About

The kafka-avro-console-producer is a producer command line to read data from standard input and write it to a Kafka topic in an avro format.

This console uses the Avro converter with the Schema Registry in order to properly write the Avro data schema.

Advertising

3 - Example

3.1 - Producer

  • Start the REPL and define the schema
kafka-avro-console-producer \
  --broker-list kafkahost:29092 --topic bar \
  --property value.schema='{"type":"record","name":"myrecord","fields":[{"name":"f1","type":"string"}]}'
  • Insert data that conform to the schema
{"f1": "value1"}
{"f1": "value2"}
{"f1": "value3"}