confluent produce


Produce data to topics. By default this command produces non-Avro data to the Kafka cluster on the localhost.

For this command to work, you must configure the PATH environment variable to point to the Confluent Platform bin directory.

For reference on how to use Confluent CLI to consume from a topic, see confluent consume.


confluent produce <topicname> [--value-format avro --property value.schema=<schema>] [other optional args]


For usage information, enter confluent help produce.

Required Arguments

Name, shorthand Default Description
<topicname>   Kafka topic to produce messages to

Optional Arguments

Here are some common optional arguments. For a full list of optional arguments:

confluent help produce
Name, shorthand Default Description
--value-format avro   Specify the topic data as Avro data.
--property value.schema=<schema>   Provide the schema for the Avro data.
--broker-list localhost:9092 Kafka brokers to connect to.


  • Produce Avro data to a topic called mytopic1 on a development Kafka cluster on localhost:

    confluent produce mytopic1 --value-format avro --property value.schema='{"type":"record","name":"myrecord","fields":[{"name":"f1","type":"string"}]}'
  • Produce non-Avro data to a topic called mytopic2 on a development Kafka cluster on localhost:

    confluent produce mytopic2
  • Produce non-Avro data to a topic called mytopic3 in Confluent Cloud (assumes you have initialized your Confluent Cloud configuration with Confluent Cloud CLI):

    # manually specify Confluent Cloud broker-list value  (substitute your server)
    confluent produce mytopic3 --producer.config ~/.ccloud/config --broker-list
    # dynamically determine Confluent Cloud broker-list value
    confluent produce mytopic3 --producer.config ~/.ccloud/config --broker-list $(grep bootstrap.server ~/.ccloud/config | awk -F'=' '{print $2;}')