Add setter for Container Customizer

Add setter for Container Customizer on AbstractMessageChannelBinder.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2345
This commit is contained in:
matthieu.dupuy
2022-04-07 21:40:12 +02:00
committed by Soby Chacko
parent ad89acf62d
commit 8682417af4
2 changed files with 37 additions and 1 deletions

View File

@@ -906,6 +906,28 @@ ListenerContainerWithDlqAndRetryCustomizer cust(KafkaTemplate<?, ?> template) {
Now, only a single retry delay needs to be greater than the consumer's `max.poll.interval.ms` property.
When working with several binders, the 'ListenerContainerWithDlqAndRetryCustomizer' bean gets overridden by the 'DefaultBinderFactory'. For the bean
to apply, you need to use a 'BinderCustomizer' to set the container customizer (See <<binder-customizer>>):
====
[source, java]
----
@Bean
public BinderCustomizer binderCustomizer(ListenerContainerWithDlqAndRetryCustomizer containerCustomizer) {
return (binder, binderName) -> {
if (binder instanceof KafkaMessageChannelBinder) {
((KafkaMessageChannelBinder) binder).setContainerCustomizer(containerCustomizer);
}
else if (binder instanceof KStreamBinder) {
...
}
else if (binder instanceof RabbitMessageChannelBinder) {
...
}
};
}
----
====
[[consumer-producer-config-customizer]]
=== Customizing Consumer and Producer configuration