I am trying to find a way to intercept Spring Cloud Stream 3.1.1 destination binding in order to modify some properties on the fly in my application. I have come to the following code snippet, but it seems it only works for a dynamic binding whereas in my case channels are defined specifically and no dynamic destination has been used, so I'm not sure what I am missing here.
@Bean
public NewDestinationBindingCallback<KafkaProducerProperties> bindingConfigurer() {
return ((channelName, channel, producerProperties, extendedProducerProperties) -> {
if ("foo".equals(channelName)) {
producerProperties.setUseNativeEncoding(producerUseNativeEncoding);
producerProperties.setPartitionCount(producerPartitionCount);
}
});
}