Yossi Shasha
Yossi Shasha

Reputation: 203

Spring Cloud Stream dynamic destination partitionCount property

I would like to use the BinderAwareChannelResolver bean in order to send message to Kafka with a topic name that is resolved on runtime. My problem is that the partitionCount in the BindingProperties of this topic defaults to 1.
This value does not reflect the true number of partitions when this topic already existed in Kafka and also when this topic is created by the client (with partition count equal to the minPartitionCount configuration value).
How can I make this property reflect the true number of partitions?

Upvotes: 0

Views: 973

Answers (1)

Gary Russell
Gary Russell

Reputation: 174554

BindingProperties are never updated to reflect the physical topic configuration; the properties are used for configuration only.

With 2.0, you can use a NewBindingCallback<KafkaProducerProperties> to modify the properties for a dynamic destination - see the documentation.

Upvotes: 1

Related Questions