CLI
Cat
Easily consume or produce Avro, JSON or Protobuf messages to a topic.
Usage: tansu cat <COMMAND>
Commands:
produce Produce Avro/JSON/Protobuf messages to a topic
consume Consume Avro/JSON/Protobuf messages from a topic
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
The cat subcommand will automatically load environment variables from a file named .env in the current directory or any of its parents.
Produce
Produce Avro/JSON/Protobuf messages to a topic
Usage: tansu cat produce [OPTIONS] <TOPIC> [FILE]
Arguments:
<TOPIC> The topic to produce messages into
[FILE] Input filename or '-' for stdin [default: -]
Options:
--broker <BROKER>
The URL of the broker to produce messages into [env: ADVERTISED_LISTENER_URL=tcp://192.168.1.50:9092] [default: tcp://localhost:9092]
--partition <PARTITION>
The partition to produce messages into [default: 0]
--schema-registry <SCHEMA_REGISTRY>
Schema registry examples are: file://./etc/schema or s3://tansu/, containing: topic.json, topic.proto or topic.avsc [env: SCHEMA_REGISTRY=file://./etc/schema]
-h, --help
Print help
Consume
Consume Avro/JSON/Protobuf messages from a topic
Usage: tansu cat consume [OPTIONS] <TOPIC>
Arguments:
<TOPIC> The topic to consume messages from
Options:
--broker <BROKER>
The URL of the broker to consume messages from [env: ADVERTISED_LISTENER_URL=] [default: tcp://localhost:9092]
--partition <PARTITION>
The partition to consume messages from [default: 0]
--schema-registry <SCHEMA_REGISTRY>
Schema registry examples are: file://./etc/schema or s3://tansu/, containing: topic.json, topic.proto or topic.avsc [env: SCHEMA_REGISTRY=]
--max-wait-time-ms <MAX_WAIT_TIME_MS>
The maximum time in milliseconds to wait for a message [default: 5000]
--min-bytes <MIN_BYTES>
The minimum number of bytes to wait for [default: 1]
--max-bytes <MAX_BYTES>
The maximum bytes to wait for [default: 52428800]
--fetch-offset <FETCH_OFFSET>
The fetch offset to start from [default: 0]
--partition-max-bytes <PARTITION_MAX_BYTES>
The partition to consume from [default: 1048576]
-h, --help
Print help
Examples
Examples using AVRO, JSON and Protocol Buffers