diff --git a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java index cef8a597d..bb60ddc64 100644 --- a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java +++ b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java @@ -210,6 +210,32 @@ public abstract class AbstractMessageChannelBinder) this.sourceCustomizer; } + private String resolveBinderName(String bindingName, BindingServiceProperties bindingServiceProperties) { + String binder = bindingServiceProperties == null ? null : bindingServiceProperties.getBindings().get(bindingName).getBinder(); + if (!StringUtils.hasText(binder)) { + return resolveFromDefaultBinder(); + } + return binder; + } + + private String resolveFromDefaultBinder() { + DefaultBinderTypeRegistry binderTypeRegistry = + AbstractMessageChannelBinder.this.getApplicationContext().getBean(DefaultBinderTypeRegistry.class); + Map binderTypes = binderTypeRegistry.getAll(); + Assert.isTrue(binderTypes.entrySet().size() == 1, "More than one binder types found, but no binder specified on the binding"); + return binderTypes.keySet().iterator().next(); + } + + private String resolveBinderType(String bindingName, BindingServiceProperties bindingServiceProperties) { + String binder = bindingServiceProperties == null ? null : bindingServiceProperties.getBindings().get(bindingName).getBinder(); + if (!StringUtils.hasText(binder)) { + return resolveFromDefaultBinder(); + } + else { + return bindingServiceProperties.getBinders().get(binder).getType(); + } + } + /** * Binds an outbound channel to a given destination. The implementation delegates to * {@link ProvisioningProvider#provisionProducerDestination(String, ProducerProperties)} @@ -290,12 +316,12 @@ public abstract class AbstractMessageChannelBinder