Pavan Jadda
Pavan Jadda

Reputation: 4871

Read Kafka topic from beginning in KStream

My spring boot project has an application that demonstrates Kafka Streams API. I am able to consume all the messages in topic customer using the command

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic customer --from-beginning

What's the similar command in Kafka Streams API to consume messages with KStream or KTable? I tried

properties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,"earliest"); properties.put("auto.offset.reset", "earliest");

Both didn't work. I did create a test case to consume with KafkaConsumer instead of Streams, it didn't work. Code uploaded to Github for reference. Any help would be great.

Upvotes: 4

Views: 10345

Answers (1)

Matthias J. Sax
Matthias J. Sax

Reputation: 62285

The tool bin/kafka-streams-application-reset.sh allows to seek since v1.1.

Cf. https://cwiki.apache.org/confluence/display/KAFKA/KIP-171+-+Extend+Consumer+Group+Reset+Offset+for+Stream+Application

Upvotes: 5

Related Questions