@@ -41,7 +41,7 @@ import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
import org.springframework.messaging.converter.DefaultContentTypeResolver;
|
||||
import org.springframework.messaging.converter.MessageConverter;
|
||||
import org.springframework.messaging.support.ChannelInterceptorAdapter;
|
||||
import org.springframework.messaging.support.ChannelInterceptor;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.MimeType;
|
||||
@@ -166,7 +166,7 @@ public class TestSupportBinder implements Binder<MessageChannel, ConsumerPropert
|
||||
* - byte[] to String conversion
|
||||
* - etc
|
||||
*/
|
||||
private final static class InboundMessageConvertingInterceptor extends ChannelInterceptorAdapter {
|
||||
private final static class InboundMessageConvertingInterceptor implements ChannelInterceptor {
|
||||
|
||||
private final DefaultContentTypeResolver contentTypeResolver = new DefaultContentTypeResolver();
|
||||
private final CompositeMessageConverterFactory converterFactory = new CompositeMessageConverterFactory();
|
||||
|
||||
@@ -54,7 +54,7 @@ import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
import org.springframework.messaging.support.ChannelInterceptorAdapter;
|
||||
import org.springframework.messaging.support.ChannelInterceptor;
|
||||
import org.springframework.retry.RecoveryCallback;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -877,7 +877,7 @@ public abstract class AbstractMessageChannelBinder<C extends ConsumerProperties,
|
||||
|
||||
}
|
||||
|
||||
private static final class EmbeddedHeadersChannelInterceptor extends ChannelInterceptorAdapter {
|
||||
private static final class EmbeddedHeadersChannelInterceptor implements ChannelInterceptor {
|
||||
|
||||
protected final Log logger;
|
||||
|
||||
|
||||
@@ -16,15 +16,11 @@
|
||||
|
||||
package org.springframework.cloud.stream.binding;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.cloud.stream.binder.Binding;
|
||||
import org.springframework.cloud.stream.binder.ProducerProperties;
|
||||
import org.springframework.cloud.stream.config.BindingServiceProperties;
|
||||
import org.springframework.integration.channel.ChannelInterceptorAware;
|
||||
import org.springframework.integration.config.GlobalChannelInterceptorProcessor;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.core.BeanFactoryMessageChannelDestinationResolver;
|
||||
@@ -44,8 +40,6 @@ import org.springframework.util.ObjectUtils;
|
||||
*/
|
||||
public class BinderAwareChannelResolver extends BeanFactoryMessageChannelDestinationResolver {
|
||||
|
||||
private final Log logger = LogFactory.getLog(BinderAwareChannelResolver.class);
|
||||
|
||||
private final BindingService bindingService;
|
||||
|
||||
private final AbstractBindingTargetFactory<? extends MessageChannel> bindingTargetFactory;
|
||||
@@ -57,8 +51,6 @@ public class BinderAwareChannelResolver extends BeanFactoryMessageChannelDestina
|
||||
|
||||
private ConfigurableListableBeanFactory beanFactory;
|
||||
|
||||
private final GlobalChannelInterceptorProcessor globalChannelInterceptorProcessor;
|
||||
|
||||
public BinderAwareChannelResolver(BindingService bindingService,
|
||||
AbstractBindingTargetFactory<? extends MessageChannel> bindingTargetFactory,
|
||||
DynamicDestinationsBindable dynamicDestinationsBindable) {
|
||||
@@ -72,7 +64,11 @@ public class BinderAwareChannelResolver extends BeanFactoryMessageChannelDestina
|
||||
this(bindingService, bindingTargetFactory, dynamicDestinationsBindable, callback, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since GlobalChannelInterceptorProcessor is no longer used
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Deprecated
|
||||
public BinderAwareChannelResolver(BindingService bindingService,
|
||||
AbstractBindingTargetFactory<? extends MessageChannel> bindingTargetFactory,
|
||||
DynamicDestinationsBindable dynamicDestinationsBindable, NewDestinationBindingCallback callback,
|
||||
@@ -83,7 +79,6 @@ public class BinderAwareChannelResolver extends BeanFactoryMessageChannelDestina
|
||||
this.bindingService = bindingService;
|
||||
this.bindingTargetFactory = bindingTargetFactory;
|
||||
this.newBindingCallback = callback;
|
||||
this.globalChannelInterceptorProcessor = globalChannelInterceptorProcessor;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,17 +131,6 @@ public class BinderAwareChannelResolver extends BeanFactoryMessageChannelDestina
|
||||
}
|
||||
}
|
||||
|
||||
private void instrumentChannelWithGlobalInterceptors(MessageChannel channel, String channelName) {
|
||||
if (channel instanceof ChannelInterceptorAware) {
|
||||
if (this.globalChannelInterceptorProcessor != null) {
|
||||
this.globalChannelInterceptorProcessor.addMatchingInterceptors((ChannelInterceptorAware) channel, channelName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger.warn("Failed to add global interceptors to '" + channelName + "' since it is not an instance of ChannelInterceptorAware.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure a new destination before it is bound.
|
||||
* @param <T> the extended properties type. If you need to support dynamic binding
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfi
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.CompositeHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.DefaultHealthIndicatorRegistry;
|
||||
import org.springframework.boot.actuate.health.Health;
|
||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||
import org.springframework.boot.actuate.health.OrderedHealthAggregator;
|
||||
@@ -51,7 +52,7 @@ public class BindersHealthIndicatorAutoConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "bindersHealthIndicator")
|
||||
public CompositeHealthIndicator bindersHealthIndicator() {
|
||||
return new CompositeHealthIndicator(new OrderedHealthAggregator());
|
||||
return new CompositeHealthIndicator(new OrderedHealthAggregator(), new DefaultHealthIndicatorRegistry());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -85,7 +86,7 @@ public class BindersHealthIndicatorAutoConfiguration {
|
||||
// this can happen due to the fact that configuration is inherited
|
||||
HealthIndicator binderHealthIndicator = indicators.isEmpty() ? new DefaultHealthIndicator()
|
||||
: new CompositeHealthIndicator(healthAggregator, indicators);
|
||||
this.bindersHealthIndicator.addHealthIndicator(binderConfigurationName, binderHealthIndicator);
|
||||
bindersHealthIndicator.getRegistry().register(binderConfigurationName, binderHealthIndicator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.integration.config.GlobalChannelInterceptorProcessor;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
import org.springframework.integration.router.AbstractMappingMessageRouter;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -193,11 +192,9 @@ public class BindingServiceConfiguration {
|
||||
public BinderAwareChannelResolver binderAwareChannelResolver(BindingService bindingService,
|
||||
AbstractBindingTargetFactory<? extends MessageChannel> bindingTargetFactory,
|
||||
DynamicDestinationsBindable dynamicDestinationsBindable,
|
||||
@Nullable BinderAwareChannelResolver.NewDestinationBindingCallback callback,
|
||||
@Nullable GlobalChannelInterceptorProcessor globalChannelInterceptorProcessor) {
|
||||
@Nullable BinderAwareChannelResolver.NewDestinationBindingCallback callback) {
|
||||
|
||||
return new BinderAwareChannelResolver(bindingService, bindingTargetFactory, dynamicDestinationsBindable,
|
||||
callback, globalChannelInterceptorProcessor);
|
||||
return new BinderAwareChannelResolver(bindingService, bindingTargetFactory, dynamicDestinationsBindable, callback);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -210,11 +210,11 @@ class DefaultDestinationPublishingMeterRegistry extends MeterRegistry implements
|
||||
}
|
||||
|
||||
private Metric<Number> toSummaryMetric(DistributionSummary summary) {
|
||||
return new Metric<Number>(summary.getId(), summary.takeSnapshot(false));
|
||||
return new Metric<Number>(summary.getId(), summary.takeSnapshot());
|
||||
}
|
||||
|
||||
private Metric<Number> toTimerMetric(Timer timer) {
|
||||
return new Metric<Number>(timer.getId(), timer.takeSnapshot(false));
|
||||
return new Metric<Number>(timer.getId(), timer.takeSnapshot());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user