How Kafka works with severals topics?
@KafkaListener(topics = {"topic1" , "topic2"}, groupId = "groupid")
For example:
- "topic1" has "topic1_message1","topic1_message2" entities on a single partition
- "topic2" has "topic2_message1","topic2_message2" entities on a single partition
What will be the reading order?
- "topic1_message1","topic1_message2","topic2_message1","topic2_message2"
- "topic1_message1","topic2_message1","topic1_message2","topic2_message2"
Or server will instanciate two threads which are reading both topics concurently?
both of these are true. it is randomly
- "topic1_message1","topic1_message2","topic2_message1","topic2_message2"
- "topic1_message1","topic2_message1","topic1_message2","topic2_message2"
because they are on single partition one thing you should know;
- "topic1_message1" comes before "topic1_message2"
- "topic2_message1" comes before "topic2_message2"