Skip to content

Commit ebca9ca

Browse files
committed
PR review
1 parent dad5b8b commit ebca9ca

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/rebalance-listeners.adoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ To enable the new protocol, configure the `group.protocol` property:
7272
spring.kafka.consumer.properties.group.protocol=consumer
7373
----
7474

75+
Keep in mind that, the above property is a Spring Boot property.
76+
If you are not using Spring Boot, you may want to set it manually as shown below.
77+
7578
Alternatively, set it programmatically:
7679

7780
[source, java]
@@ -82,10 +85,8 @@ ConsumerFactory<String, String> factory = new DefaultKafkaConsumerFactory<>(prop
8285
----
8386

8487
The new protocol works seamlessly with `ConsumerAwareRebalanceListener`.
85-
Due to incremental rebalancing, `onPartitionsAssigned` may be called multiple times with smaller partition sets, unlike the single callback typical of the legacy protocol (`group.protocol=classic`).
88+
Due to incremental rebalancing, `onPartitionsAssigned` may be called multiple times with smaller partition sets, unlike the single callback typical of the legacy protocol.
8689

8790
The new protocol uses server-side partition assignments, ignoring client-side custom assignors set via `spring.kafka.consumer.partition-assignment-strategy`.
8891
A warning is logged if a custom assignor is detected.
89-
To use custom assignors, set `group.protocol=classic`.
90-
91-
Test applications with `group.protocol=consumer` in a non-production environment to assess rebalancing impacts, and monitor callback frequency for performance tuning.
92+
To use custom assignors, set `group.protocol=classic` (which is the default if you don't specify a value for `group.protocol`).

spring-kafka/src/test/java/org/springframework/kafka/listener/ConsumerRebalanceProtocolTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void onPartitionsAssigned(Consumer<?, ?> consumer, Collection<TopicPartit
109109
}
110110
};
111111

112-
ContainerProperties containerProps = new ContainerProperties("rebalance.test1");
112+
ContainerProperties containerProps = new ContainerProperties("rebalance.test");
113113
containerProps.setGroupId(groupId);
114114
containerProps.setConsumerRebalanceListener(listener);
115115
containerProps.setMessageListener((MessageListener<String, String>) (ConsumerRecord<String, String> record) -> {

0 commit comments

Comments
 (0)