liveBook · Manning

Kafka-console-consumer

As explained in Apache Kafka in Action

kafka-console-consumer.sh is an Apache Kafka command-line utility that reads records from a topic and displays them on the console.

kafka-console-consumer.sh reads records from a Kafka topic and displays them in the terminal. It is useful for checking a price-change stream, simulating an analysis component, or watching inventory updates as they arrive. section 2.0 section 2.3

A basic consumer uses the topic and broker connection, with these operational behaviors:

  • Expect it to keep running until Ctrl-C; by default, it waits for and prints only new records. section 2.3
  • Add --from-beginning when already written records must be displayed. section 2.3

Watch current changes and replay history

Start one consumer without --from-beginning to monitor new price changes immediately. Start another with --from-beginning to replay the retained history independently; both can display the same topic without coordinating with each other. section 2.4

How Apache Kafka in Action covers it

How deep it goes
Demonstrates topic selection, broker connection, default offsets, replay, cancellation, and parallel consumers without covering advanced consumer configuration.
Examples
Uses products.prices.changelog, coffee-pad price records, localhost:9092, and multiple terminal consumers.
What it assumes
Assumes Kafka is installed and provides access to a Kafka cluster and an existing topic.
What you can do after
Operate it via kafka-console-consumer.sh to watch new records or replay available topic data.
How it connects
Connects Kafka topics with message production, offsets, retention, real-time processing, and independent consumers.

Also explained in

Compare how 2 books explain kafka-console-consumer →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Apache Kafka in Action. The section links point to the parts of the book it draws on.