java - 什么是 Spring KafkaListener 的多个主题阅读策略?
问题描述
Kafka 如何处理多个主题?
@KafkaListener(topics = {"topic1" , "topic2"}, groupId = "groupid")
例如:
- “topic1”在单个分区上有“topic1_message1”、“topic1_message2”实体
- “topic2”在单个分区上有“topic2_message1”、“topic2_message2”实体
阅读顺序是什么?
- "topic1_message1","topic1_message2","topic2_message1","topic2_message2"
- "topic1_message1","topic2_message1","topic1_message2","topic2_message2"
或者服务器将实例化两个同时读取两个主题的线程?
解决方案
这两个都是真的。它是随机的
- "topic1_message1","topic1_message2","topic2_message1","topic2_message2"
- "topic1_message1","topic2_message1","topic1_message2","topic2_message2"
因为它们位于单个分区上,所以您应该知道一件事;
- “topic1_message1”在“topic1_message2”之前
- “topic2_message1”在“topic2_message2”之前
推荐阅读
- javascript - 无法通过使用数据表的列过滤来获取 Javascript 源数据
- ios - SwiftUI 或 Beta-State 导致崩溃?
- python - 如何使用 pathlib 模块对文件进行多操作系统级别的访问?
- java - MvcResult 的状态为 200,包括响应,但断言失败
- azure-devops - 推送 Azure Git 存储库时未调用生成触发器
- excel - 将对象添加到方法时,VBA 对象不支持此属性或方法
- c# - 泛型类的泛型参数的扩展方法
- javascript - 如何在 JS 中创建十六进制编码的 HmacSHA256 安全哈希?
- javascript - 按特定给定顺序对 JSON 数组进行排序
- python - 如何修复错误的 UTF-8 解码字符串?