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**

(cherry picked from commit 45fe5be0cd)
This commit is contained in:
Amit Sadafule
2019-06-11 10:27:55 -04:00
committed by Artem Bilan
parent cebfe8a58d
commit 2afe115168

View File

@@ -37,6 +37,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;
@@ -53,6 +54,7 @@ import reactor.core.CoreSubscriber;
* @author Oleg Zhurakousky
* @author Gary Russell
* @author Artem Bilan
* @author Amit Sadafule
*/
@IntegrationManagedResource
public abstract class AbstractMessageHandler extends IntegrationObjectSupport
@@ -99,6 +101,11 @@ public abstract class AbstractMessageHandler extends IntegrationObjectSupport
this.metricsCaptor = metricsCaptor;
}
@Nullable
protected MetricsCaptor getMetricsCaptor() {
return this.metricsCaptor;
}
@Override
public void setOrder(int order) {
this.order = order;