kafka-console-consumer

Learn how to use the kafka-console-consumer tool.

The kafka-console-consumer tool can be useful in a couple of ways:

  • Acting as an independent consumer of particular topics. This can be useful to compare results against a consumer program that you’ve written.
  • To test general topic consumption without the need to write any consumer code.

Examples of usage:

kafka-console-consumer --bootstrap-server [BROKER1],[BROKER2]... --topic [TOPIC] --from-beginning
[record-earliest-offset]
[record-earliest-offset+1]

Note the following about the tool:

  • This tool prints all records and keeps outputting as more records are written to the topic.
  • If the kafka-console-consumer tool is given no flags, it displays the full help message.
  • In older versions of Kafka, it may have been necessary to use the --new-consumer flag. As of Apache Kafka version 0.10.2, this is no longer necessary.