Class CustomSuffixBindHandler
- java.lang.Object
-
- org.springframework.boot.context.properties.bind.AbstractBindHandler
-
- com.broadleafcommerce.cloudstream.binding.CustomSuffixBindHandler
-
- All Implemented Interfaces:
org.springframework.boot.context.properties.bind.BindHandler
public class CustomSuffixBindHandler extends org.springframework.boot.context.properties.bind.AbstractBindHandler
Custom SpringBindHandler
to support dynamic re-naming of Spring Cloud StreamBindingProperties
at runtime. This supports use cases where there is a need to share a single message broker instance across multiple environment specific or region specific application instances. To facilitate segmenting destinations and groups for each environment, this custom bind handler allows modifying each ALREADY DEFINED Spring Cloud Stream destination and group definitions with a particular suffix to allow segmentation across environments via a property. e.g. if you had existing bindings already defined like: spring.cloud.stream.binding.input.destination=topic spring.cloud.stream.binding.input.group=subscription Assuming the appropriate SUFFIX is configuredCustomCloudstreamBindingConfiguration
, this custom bind handler will modify the properties and bind the following: "topic-SUFFIX" and "subscription-SUFFIX" instead- Author:
- Elbert Bautista (elbertbautista)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> org.springframework.boot.context.properties.bind.Bindable<T>
onStart(org.springframework.boot.context.properties.source.ConfigurationPropertyName name, org.springframework.boot.context.properties.bind.Bindable<T> target, org.springframework.boot.context.properties.bind.BindContext context)
Object
onSuccess(org.springframework.boot.context.properties.source.ConfigurationPropertyName name, org.springframework.boot.context.properties.bind.Bindable<?> target, org.springframework.boot.context.properties.bind.BindContext context, Object result)
-
Methods inherited from class org.springframework.boot.context.properties.bind.AbstractBindHandler
onFailure, onFinish
-
-
-
-
Method Detail
-
onStart
public <T> org.springframework.boot.context.properties.bind.Bindable<T> onStart(org.springframework.boot.context.properties.source.ConfigurationPropertyName name, org.springframework.boot.context.properties.bind.Bindable<T> target, org.springframework.boot.context.properties.bind.BindContext context)
- Specified by:
onStart
in interfaceorg.springframework.boot.context.properties.bind.BindHandler
- Overrides:
onStart
in classorg.springframework.boot.context.properties.bind.AbstractBindHandler
-
onSuccess
public Object onSuccess(org.springframework.boot.context.properties.source.ConfigurationPropertyName name, org.springframework.boot.context.properties.bind.Bindable<?> target, org.springframework.boot.context.properties.bind.BindContext context, Object result)
- Specified by:
onSuccess
in interfaceorg.springframework.boot.context.properties.bind.BindHandler
- Overrides:
onSuccess
in classorg.springframework.boot.context.properties.bind.AbstractBindHandler
-
-