Spring Cloud Stream 动态目标 partitionCount 属性

Spring Cloud Stream dynamic destination partitionCount property

我想使用 BinderAwareChannelResolver bean 向 Kafka 发送消息,主题名称在运行时解析。 我的问题是这个topic的BindingProperties中的partitionCount默认为1。
当这个topic已经存在于Kafka中以及当这个主题由客户端创建(分区计数等于 minPartitionCount 配置值)。
我怎样才能使这个 属性 反映分区的真实数量?

BindingProperties 永远不会更新以反映物理主题配置;这些属性仅用于配置。

在 2.0 中,您可以使用 NewBindingCallback<KafkaProducerProperties> 修改动态目标的属性 - 请参阅 the documentation