groupId in RetryTopicConfiguration #2688
-
Team The below note from https://docs.spring.io/spring-kafka/reference/html/#using-retrytopicconfiguration-beans is not clear to me The retry topics' and dlt’s consumers will be assigned to a consumer group with a group id that is the combination of the one with you provide in the groupId parameter of the @KafkaListener annotation with the topic’s suffix. If you don’t provide any they’ll all belong to the same group, and rebalance on a retry topic will cause an unnecessary rebalance on the main topic. In general
Similarly
If we introduce say Non-blocking retry on order-service and order-somethingelse-service and say NO group id is passed in any of the KafkaListners, what does it mean by If you don’t provide any they’ll all belong to the same group, and rebalance on a retry topic will cause an unnecessary rebalance on the main topic. ? Is this recommending to introduce a new group id per KafkaListner so that the dlt and retry topic belong to a group id? In general 2 instances of a service with a group id consuming messages from 2 partitioned topic when one instance goes down, rebalance occurs and the active instance will consume from both the partitions. So why is this new layer of group id in KafkaListner and what is it supposed to prevent? Kindly clarify. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
It's pretty straightforward. @RetryableTopic
@KafkaListener(topics = "topic1")
void listen1(String in) {
System.out.println(in);
}
@RetryableTopic
@KafkaListener(topics = "topic2")
void listen2(String in) {
System.out.println(in);
} With the default configuration, these listeners, and consumer group id of
All 8 consumers are in the same group. This means if there is a rebalance on topic2 (and its retry containers), it will cause an unnecessary rebalance on topic 1. with @RetryableTopic
@KafkaListener(id = "one", topics = "topic1")
void listen1(String in) {
System.out.println(in);
}
@RetryableTopic
@KafkaListener(id = "two", topics = "topic2")
void listen2(String in) {
System.out.println(in);
} we get
with each consumer in its own group. By default, the |
Beta Was this translation helpful? Give feedback.
It's pretty straightforward.
With the default configuration, these listeners, and consumer group id of
foo
, we getAll 8 consumers are in the same group.…