【发布时间】:2018-06-21 14:47:28
【问题描述】:
我被困在一个典型的用例或场景中,我不确定 Kafka 的行为会是什么......
场景:我正在使用 Spring Kafka 和 Spring Boot。在我的应用程序中,我有一个 Rest 端点,它将从主题的开头读取所有消息以检查消息是否重复,如果不重复则写入主题。
当部署相同微服务的多个实例并且为 seekFromBegining 操作移动偏移量时,我对应用程序的行为感到困惑。
我心中的几个问题是:
do reading from beginning of a topic (with the help of seek) block the topic ?
If Yes. then how to solve this typical use case where we have to validate for the
duplication of message before writing to the topic.
使用 DB 不是解决方案,因为它会占用大量资源。并使应用程序变慢。
提前谢谢大家
【问题讨论】:
标签: spring-boot apache-kafka kafka-consumer-api spring-kafka