0

在一个 spring 集成项目中,我有一个同步发送和接收消息的出站网关。我想记录这种操作所花费的时间。

<jms:outbound-gateway id="jmsOutGateway"
                   request-destination="outQueue"
                   request-channel="outboundJmsRequests"
                   reply-channel="jmsReplies"/>

我尝试搜索但只能找到使用 AOP 和 PerformanceMonitorInterceptor 来跟踪方法的示例。

4

1 回答 1

0

You can do it like this:

<int-jms:outbound-gateway id="jmsOutGateway"
                   request-destination="outQueue"
                   request-channel="outboundJmsRequests"
                   reply-channel="jmsReplies">
    <int-jms:request-handler-advice-chain>
        <bean class="org.springframework.aop.interceptor.PerformanceMonitorInterceptor"/>
    </int-jms:request-handler-advice-chain>
</int-jms:outbound-gateway>

The <request-handler-advice-chain> is applied for the AbstractReplyProducingMessageHandler.handleRequestMessage method and <int-jms:outbound-gateway> populates JmsOutboundGateway - an implementation of AbstractReplyProducingMessageHandler.

于 2014-05-31T18:50:32.947 回答