Dynamic partition improvements in Kafka binder
Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2706 - Update partition count changes in Kafka dynamically during runtime - Checkstyle fixes - PartitionHandler changes - Improved handling of expression with 'payload' in the logic - Removed getter/setter for PartitionHandler and use ReflectionUtils within Test - Renamed property to 'dynamicPartitionUpdatesEnabled' and improved documentation (also one line per sentence) - Improved/renamed test to use embeddedkafka and really test update behaviour - Javadoc
This commit is contained in:
committed by
Soby Chacko
parent
e19bdd4381
commit
29c3cd7cdd
@@ -65,6 +65,14 @@ You can override this default by using the `partitionSelectorExpression` or `par
|
||||
Since partitions are natively handled by Kafka, no special configuration is needed on the consumer side.
|
||||
Kafka allocates partitions across the instances.
|
||||
|
||||
NOTE: The partitionCount for a kafka topic may change during runtime (e.g. due to an adminstration task).
|
||||
The calculated partitions will be different after that (e.g. new partitions will be used then).
|
||||
Since 4.0.3 of Spring Cloud Stream runtime changes of partition count will be supported.
|
||||
See also parameter 'spring.kafka.producer.properties.metadata.max.age.ms' to configure update interval.
|
||||
Due to some limitations it is not possible to use a 'partition-key-expression' which references the 'payload' of a message, the mechanism will be disabled in that case.
|
||||
The overall behavior is disabled by default and can be enabled using configuration parameter 'producer.dynamicPartitionUpdatesEnabled=true'.
|
||||
|
||||
|
||||
The following Spring Boot application listens to a Kafka stream and prints (to the console) the partition ID to which each message goes:
|
||||
|
||||
[source,java]
|
||||
|
||||
Reference in New Issue
Block a user