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.
我想知道 Kafka 是否有能力从一开始就重放消息(例如,如果发生硬盘驱动器/网络崩溃)?
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屋!