Apache Kafka: Replay messages in a topic

2019-01-26 10:02发布

问题:

I'm considering using Apache Kafka as an event store for storing events within a microservice.

One thing that I read through various blogs is that Kafka can be considered to be a single source of truth, where Kafka log will store all the events for a given topic.

I was wondering if Kafka has the ability to replay messages since the beginning of time (in case there is a hard drive/network crash that occurs for example)?

(note that i see that there are some logs stored in the /tmp folder under a topic directory). Does anyone know of any command (if any) that can be invoked to replay the messages in the topic?

回答1:

Yes, you can seek to a specific offset, but

beginning of time

depends on the topic or broker configuration. IIRC, the default retention is 7 days.

Refer to the the Kafka documentation.