apache-kafka kafka console tools kafka-simple-consumer-shell


Example

This consumer is a low-level tool which allows you to consume messages from specific partitions, offsets and replicas.

Useful parameters:

  • parition: the specific partition to consume from (default to all)
  • offset: the beginning offset. Use -2 to consume messages from the beginning, -1 to consume from the end.
  • max-messages: number of messages to print
  • replica: the replica, default to the broker-leader (-1)

Exemple:

kafka-simple-consumer-shell  \
    --broker-list localhost:9092 \
    --partition 1 \
    --offset 4 \
    --max-messages 3 \
    --topic test-topic

displays 3 messages from partition 1 beginning at offset 4 from topic test-topic.