From 2b396d2a91c256e38ffe624ca16dca3e4208d2d3 Mon Sep 17 00:00:00 2001 From: yhao3 Date: Fri, 20 Sep 2024 11:16:22 +0800 Subject: [PATCH 1/2] Fix typo in `message-listener-container.adoc` --- .../kafka/receiving-messages/message-listener-container.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/message-listener-container.adoc b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/message-listener-container.adoc index 910bf9e056..0783b6011d 100644 --- a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/message-listener-container.adoc +++ b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/message-listener-container.adoc @@ -142,7 +142,7 @@ For example, if you have three topics with five partitions each and you want to This is because the default Kafka `PartitionAssignor` is the `RangeAssignor` (see its Javadoc). For this scenario, you may want to consider using the `RoundRobinAssignor` instead, which distributes the partitions across all of the consumers. Then, each consumer is assigned one topic or partition. -To change the `PartitionAssignor`, you can set the `partition.assignment.strategy` consumer property (`ConsumerConfigs.PARTITION_ASSIGNMENT_STRATEGY_CONFIG`) in the properties provided to the `DefaultKafkaConsumerFactory`. +To change the `PartitionAssignor`, you can set the `partition.assignment.strategy` consumer property (`ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG`) in the properties provided to the `DefaultKafkaConsumerFactory`. When using Spring Boot, you can assign set the strategy as follows: From d2706639e2919c6f8f0866f29a1005808a8d9874 Mon Sep 17 00:00:00 2001 From: yhao3 Date: Fri, 20 Sep 2024 11:19:15 +0800 Subject: [PATCH 2/2] Replace deprecated `PartitionAssignor` with `ConsumerPartitionAssignor` in `message-listener-container.adoc` --- .../kafka/receiving-messages/message-listener-container.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/message-listener-container.adoc b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/message-listener-container.adoc index 0783b6011d..e594d70491 100644 --- a/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/message-listener-container.adoc +++ b/spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/message-listener-container.adoc @@ -139,10 +139,10 @@ For the first constructor, Kafka distributes the partitions across the consumers ==== When listening to multiple topics, the default partition distribution may not be what you expect. For example, if you have three topics with five partitions each and you want to use `concurrency=15`, you see only five active consumers, each assigned one partition from each topic, with the other 10 consumers being idle. -This is because the default Kafka `PartitionAssignor` is the `RangeAssignor` (see its Javadoc). +This is because the default Kafka `ConsumerPartitionAssignor` is the `RangeAssignor` (see its Javadoc). For this scenario, you may want to consider using the `RoundRobinAssignor` instead, which distributes the partitions across all of the consumers. Then, each consumer is assigned one topic or partition. -To change the `PartitionAssignor`, you can set the `partition.assignment.strategy` consumer property (`ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG`) in the properties provided to the `DefaultKafkaConsumerFactory`. +To change the `ConsumerPartitionAssignor`, you can set the `partition.assignment.strategy` consumer property (`ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG`) in the properties provided to the `DefaultKafkaConsumerFactory`. When using Spring Boot, you can assign set the strategy as follows: