Karan Khanna
Karan Khanna

Reputation: 2147

Apache Kafka console Producer-Consumer example

I have installed Apache Kafka to a Windows system and have tried a console Producer-Consumer example. In case I add new consumers to the topic, only the messages after adding the consumer are printed to the console. Is there any way to get all the messages of the particular topic?

Upvotes: 1

Views: 690

Answers (1)

avr
avr

Reputation: 4893

You need to add --from-beginning flag to your console consumer command to get all messages.

Example command:

bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning

Upvotes: 3

Related Questions