Apache Kafka: Replay messages in a topic

微笑、不失礼 提交于 2019-11-28 03:17:41

问题


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.




回答2:


Yes, You can replay message. As Consumer have a control over resetting the offset. You can start reading messages from the beginning or if you know any existing offset value you can read it from there as well. Once the message is committed it will be in there in topic until its retention period is over. Default retention period is 7 days, however you can change it any time.



来源:https://stackoverflow.com/questions/48482263/apache-kafka-replay-messages-in-a-topic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!