1
我想了解如何使用春季集成4.2(http://docs.spring.io/spring-integration/reference/htmlsingle/#mgmt-handler-features)中引入的指標框架來剖析我的Spring集成應用程序。春季集成 - 使用IntegrationManagementConfigurer與服務激活器
我可以看到如何使用該框架來監視通道和消息處理程序(終點)。我如何監視使用@ServiceActivator
註釋的bean?
for (String monitoredChannel : getMonitoredChannels()) {
MessageChannelMetrics channelMetrics = integrationManagementConfigurer.getChannelMetrics(monitoredChannel);
LOGGER.info("Channel {}, Send Count: {}", monitoredChannel, channelMetrics.getSendCount());
}
for (String monitoredHandler : getMonitoredHandlers()) {
MessageHandlerMetrics handlerMetrics = integrationManagementConfigurer.getHandlerMetrics(monitoredHandler);
LOGGER.info("Handler {}, Max Duration: {}", monitoredHandler, handlerMetrics.getDuration().getMax());
LOGGER.info("Handler {}, Min Duration: {}", monitoredHandler, handlerMetrics.getDuration().getMin());
LOGGER.info("Handler {}, Mean Duration: {}", monitoredHandler, handlerMetrics.getMeanDuration());
}
是否有類似的方式來監視命名的服務激活器?這就是我整合-context.xml的樣子:
<int:chain input-channel="messageReceived" output-channel="messageValidated" id="messageValidationChain">
<int:service-activator ref="enricher" method="getMessageAttributes" id="attributeEnricher" />
<int:service-activator ref="stateValidator" method="processMessage" id="stateValidator" />
<int:service-activator ref="attributeValidator" method="validateMessage" id="attributeValidator"/>
</int:chain>
我希望能夠剖析在處理鏈中的每個ServiceActivator
需要多長時間,並跟蹤指標,如最小,最大的,平均持續時間,消息計數等等。
謝謝加里。由於我使用的是鏈而不是顯式通道,因此我發現ServiceActivator bean被定義爲父鏈的子節點。即,可以通過以下方式解決豆類: $子。 .handler。在上面的例子中,我能夠通過引用messageValidationChain $ child.attributeEnricher.handler來獲得MessageHandlerMetrics bean。 –
Luhar