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**
This commit is contained in:
Amit Sadafule
2019-06-11 19:57:55 +05:30
committed by Artem Bilan
parent 78a0ec74e7
commit 45fe5be0cd

View File

@@ -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;