Skip to main content

Apache Kafka producer and consumer tool.

# To consume messages starting with the newest offset:
kafkacat -C -t <topic> -b <brokers>

# To consume messages starting with the oldest offset and exit after the last message is received:
kafkacat -C -t <topic> -b <brokers> -o beginning -e

# To consume messages as a Kafka consumer group:
kafkacat -G <group_id> <topic> -b <brokers>

# To publish message by reading from 'stdin':
echo <message> | kafkacat -P -t <topic> -b <brokers>

# To publish messages by reading from a file:
kafkacat -P -t <topic> -b <brokers> <path/to/file>

# To list metadata for all topics and brokers:
kafkacat -L -b <brokers>

# To list metadata for a specific topic:
kafkacat -L -t <topic> -b <brokers>

# To get offset for a topic/partition for a specific point in time:
kafkacat -Q -t <topic>:<partition>:<unix_timestamp> -b <brokers>