Apache Kafka:重播主题中的消息 [英] Apache Kafka: Replay messages in a topic
问题描述
我正在考虑使用Apache Kafka作为事件存储来在微服务中存储事件.
I'm considering using Apache Kafka as an event store for storing events within a microservice.
我在各个博客中读到的一件事是,Kafka可以被视为唯一的事实来源,Kafka日志将存储给定主题的所有事件.
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)?
(请注意,我看到在主题目录下的/tmp文件夹中存储了一些日志).是否有人知道可以调用以重播主题中消息的任何命令(如果有)?
(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?
推荐答案
是的,您可以搜索特定的偏移量,但是
Yes, you can seek to a specific offset, but
开始时间
取决于主题或代理配置.IIRC,默认保留期为7天.
depends on the topic or broker configuration. IIRC, the default retention is 7 days.
请参阅 Kafka文档.
这篇关于Apache Kafka:重播主题中的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!