Class BinderFix
java.lang.Object
de.iip_ecosphere.platform.transport.spring.BinderFix
Provides a fix for multi-binder configurations in Spring Cloud Stream at least until version 3.1.1. There, the
type value for custom binders is not (always) correctly used and reported as null. We use
either the Spring-like binders structure
binders.properties (then like structure below
spring.cloud.stream.binders, see BinderFixProperties) or, as fallback,
spring.cloud.stream.defaultBinder but without settings, environment etc. Needs to be revisited
for more recent versions. Code is based on StackOverflow (link in code).- Author:
- Gary Russell, StackOverflow, Holger Eichelberger, SSE
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Collection<org.springframework.cloud.stream.binder.DefaultBinderFactory.Listener> private Stringprivate BinderFixProperties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.cloud.stream.binder.BinderFactorybinderFactory(org.springframework.cloud.stream.binder.BinderTypeRegistry binderTypeRegistry, org.springframework.cloud.stream.config.BindingServiceProperties bindingServiceProperties) Returns the binder factory instance.getBinderConfigurations(org.springframework.cloud.stream.binder.BinderTypeRegistry binderTypeRegistry, org.springframework.cloud.stream.config.BindingServiceProperties bindingServiceProperties, String defaultBinder, BinderFixProperties properties) Returns the binder configurations.
-
Field Details
-
binderFactoryListeners
@Autowired(required=false) private Collection<org.springframework.cloud.stream.binder.DefaultBinderFactory.Listener> binderFactoryListeners -
properties
-
defaultBinder
-
-
Constructor Details
-
BinderFix
public BinderFix()
-
-
Method Details
-
binderFactory
@Bean public org.springframework.cloud.stream.binder.BinderFactory binderFactory(org.springframework.cloud.stream.binder.BinderTypeRegistry binderTypeRegistry, org.springframework.cloud.stream.config.BindingServiceProperties bindingServiceProperties) Returns the binder factory instance.- Parameters:
binderTypeRegistry- the binder type registrybindingServiceProperties- the binding service properties- Returns:
- the binder factory
-
getBinderConfigurations
private static Map<String,org.springframework.cloud.stream.binder.BinderConfiguration> getBinderConfigurations(org.springframework.cloud.stream.binder.BinderTypeRegistry binderTypeRegistry, org.springframework.cloud.stream.config.BindingServiceProperties bindingServiceProperties, String defaultBinder, BinderFixProperties properties) Returns the binder configurations. Copied and adapted fromBindingServiceConfiguration.- Parameters:
binderTypeRegistry- the binder type registrybindingServiceProperties- the binding service propertiesdefaultBinder- the default binder as second-level fallbackproperties- the binder properties as first-level fallback- Returns:
- the binder configurations
-