Consume messages starting with the newest offset:
kcat -C -t topic -b brokers
Consume messages starting with the oldest offset and exit after the last message is received:
kcat -C -t topic -b brokers -o beginning -e
Consume messages as a Kafka consumer group:
kcat -G group_id topic -b brokers
Publish message by reading from stdin:
echo message | kcat -P -t topic -b brokers
Publish messages by reading from a file:
kcat -P -t topic -b brokers path/to/file
List metadata for all topics and brokers:
kcat -L -b brokers
List metadata for a specific topic:
kcat -L -t topic -b brokers
Get offset for a topic/partition for a specific point in time:
kcat -Q -t topic:partition:unix_timestamp -b brokers
kcat is a generic non-JVM producer and consumer for Apache Kafka 0.8, think of it as a netcat for Kafka.
In producer mode (
-P ), kcat reads messages from stdin, delimited with a configurable delimeter and produces them to the provided Kafka cluster, topic and partition. In consumer mode (
-C ), kcat reads messages from a topic and partition and prints them to stdout using the configured message delimiter.
-C are specified kcat attempts to figure out the mode automatically based on stdin/stdout tty types.
kcat also features a metadata list mode (
-L ), to display the current state of the Kafka cluster and its topics and partitions.
For a more extensive help and some simple examples, run kcat with