什么是Spring KafkaListener 多主题阅读攻略?

What is Spring KafkaListener reading strategy with severals topics?

Kafka 如何处理多个主题?

 @KafkaListener(topics = {"topic1" , "topic2"}, groupId = "groupid")

例如:

阅读顺序是什么?

或者服务器会实例化两个同时读取两个主题的线程?

这两个都是真的。是随机的

  • "topic1_message1","topic1_message2","topic2_message1","topic2_message2"
  • "topic1_message1","topic2_message1","topic1_message2","topic2_message2"

因为它们在单个分区上,所以你应该知道一件事;

  1. "topic1_message1" 在"topic1_message2"
  2. 之前
  3. "topic2_message1" 在"topic2_message2"
  4. 之前