From 45fe5be0cdc0c0c49c13190171da29b35e9f3bd7 Mon Sep 17 00:00:00 2001 From: Amit Sadafule Date: Tue, 11 Jun 2019 19:57:55 +0530 Subject: [PATCH] GH-2956: Add MessageHandler.getMetricsCaptor() Fixes https://github.com/spring-projects/spring-integration/issues/2956 * Add `getMetricsCaptor.getMetricsCaptor()` for possible customization in the target implementation * Added dependancy for `@Nullable` **Cherry-pick to 5.1.x** --- .../integration/handler/AbstractMessageHandler.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java index fd44c546da..16249ee13c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java @@ -35,6 +35,7 @@ import org.springframework.integration.support.management.metrics.MetricsCaptor; import org.springframework.integration.support.management.metrics.SampleFacade; import org.springframework.integration.support.management.metrics.TimerFacade; import org.springframework.integration.support.utils.IntegrationUtils; +import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHandler; import org.springframework.util.Assert; @@ -51,6 +52,7 @@ import reactor.core.CoreSubscriber; * @author Oleg Zhurakousky * @author Gary Russell * @author Artem Bilan + * @author Amit Sadafule */ @SuppressWarnings("deprecation") @IntegrationManagedResource @@ -100,6 +102,11 @@ public abstract class AbstractMessageHandler extends IntegrationObjectSupport this.metricsCaptor = metricsCaptorToRegister; } + @Nullable + protected MetricsCaptor getMetricsCaptor() { + return this.metricsCaptor; + } + @Override public void setOrder(int order) { this.order = order;