use of org.springframework.cloud.stream.binder.ExtendedConsumerProperties in project spring-cloud-stream by spring-cloud.
the class BindingService method bindConsumer.
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> Collection<Binding<T>> bindConsumer(T input, String inputName) {
String bindingTarget = this.bindingServiceProperties.getBindingDestination(inputName);
String[] bindingTargets = StringUtils.commaDelimitedListToStringArray(bindingTarget);
Collection<Binding<T>> bindings = new ArrayList<>();
Binder<T, ConsumerProperties, ?> binder = (Binder<T, ConsumerProperties, ?>) getBinder(inputName, input.getClass());
ConsumerProperties consumerProperties = this.bindingServiceProperties.getConsumerProperties(inputName);
if (binder instanceof ExtendedPropertiesBinder) {
Object extension = ((ExtendedPropertiesBinder) binder).getExtendedConsumerProperties(inputName);
ExtendedConsumerProperties extendedConsumerProperties = new ExtendedConsumerProperties(extension);
BeanUtils.copyProperties(consumerProperties, extendedConsumerProperties);
consumerProperties = extendedConsumerProperties;
}
validate(consumerProperties);
for (String target : bindingTargets) {
Binding<T> binding;
if (input instanceof PollableSource) {
binding = doBindPollableConsumer(input, inputName, binder, consumerProperties, target);
} else {
binding = doBindConsumer(input, inputName, binder, consumerProperties, target);
}
bindings.add(binding);
}
bindings = Collections.unmodifiableCollection(bindings);
this.consumerBindings.put(inputName, new ArrayList<Binding<?>>(bindings));
return bindings;
}
Aggregations