confluent kafka topic produce

Description

Produce messages to a Kafka topic.

When using this command, you cannot modify the message header, and the message header will not be printed out.

confluent kafka topic produce <topic> [flags]

Flags

--bootstrap string                    Kafka cluster endpoint (Confluent Cloud); or comma-separated list of broker hosts (Confluent Platform), each formatted as "host" or "host:port".
--key-schema string                   The ID or filepath of the message key schema.
--schema string                       The ID or filepath of the message value schema.
--key-format string                   Format of message key as "string", "avro", "double", "integer", "jsonschema", or "protobuf". Note that schema references are not supported for Avro. (default "string")
--value-format string                 Format message value as "string", "avro", "double", "integer", "jsonschema", or "protobuf". Note that schema references are not supported for Avro. (default "string")
--references string                   The path to the message value schema references file.
--parse-key                           Parse key from the message.
--delimiter string                    The delimiter separating each key and value. (default ":")
--config strings                      A comma-separated list of configuration overrides ("key=value") for the producer client.
--config-file string                  The path to the configuration file for the producer client, in JSON or Avro format.
--schema-registry-endpoint string     Endpoint for Schema Registry cluster.
--key-references string               The path to the message key schema references file.
--api-key string                      API key.
--api-secret string                   API secret.
--schema-registry-api-key string      Schema registry API key.
--schema-registry-api-secret string   Schema registry API secret.
--cluster string                      Kafka cluster ID.
--context string                      CLI context name.
--environment string                  Environment ID.
--ca-location string                  File or directory path to one or more CA certificates for verifying the broker's key with SSL.
--username string                     SASL_SSL username for use with PLAIN mechanism.
--password string                     SASL_SSL password for use with PLAIN mechanism.
--cert-location string                Path to client's public key (PEM) used for SSL authentication.
--key-location string                 Path to client's private key (PEM) used for SSL authentication.
--key-password string                 Private key passphrase for SSL authentication.
--protocol string                     Specify the broker communication protocol as "PLAINTEXT", "SASL_SSL", or "SSL". (default "SSL")
--sasl-mechanism string               SASL_SSL mechanism used for authentication. (default "PLAIN")

Global Flags

-h, --help            Show help for this command.
    --unsafe-trace    Equivalent to -vvvv, but also log HTTP requests and responses which might contain plaintext secrets.
-v, --verbose count   Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace).

Examples

Produce to topic “my_topic” in Confluent Cloud with a Confluent Cloud API key.

confluent kafka topic consume my_topic --api-key 0000000000000000 --api-secret <API_SECRET> --bootstrap SASL_SSL://pkc-12345.us-west-2.aws.confluent.cloud:9092 --value-format avro --schema test.avsc --schema-registry-endpoint https://psrc-12345.us-west-2.aws.confluent.cloud --schema-registry-api-key 0000000000000000 --schema-registry-api-secret <SCHEMA_REGISTRY_API_SECRET>

See Also