2

Edit: Mule 3.3.1

I want to log the amount of time my flow spends waiting on an external service, plus some additional information about the call. Right now, I'm doing that with a custom component that I declare globally:

<spring:beans>
    <spring:bean id="idAuth" class="com.ca.eai.esb.component.OutboundLogger">
        <spring:property name="calloutName" value="Authorization"/>
    </spring:bean>
</spring:beans>

and then invoke before and after my callout:

<component>
    <spring-object bean="idAuth"/>
</component>

<https:outbound-endpoint..../>

<component>
    <spring-object bean="idAuth"/>
</component>

It keeps track of time plus records some other facts.

My question is if there is a better way? I'm thinking about how you can log before & after information about a flow by implementing an AbstractEnvelopeInterceptor and declaring it at the beginning of the flow. Is there something analogous that you can implement and bind to the endpoint and have a method invoked on request and then another method invoked on response?

4

2 回答 2

1

如果您使用 MMC 进行部署。您可以使用Custom Business Events消息处理器。为此,您必须启用甚至在流中进行跟踪。这样在 MMC 下Buiness Events可​​以看到有关您的流程的详细信息以及每个消息处理器Processing Time和日期以及所有其他相关信息。知道它是3.2版本。不确定旧版本。你可以检查一下。在流中启用事件:http: //www.mulesoft.org/documentation/display/current/Business+Events 在 MMC 中查询:http: //www.mulesoft.org/documentation/display/current/Tracking+and+Querying+商务+活动

于 2013-10-24T12:28:50.997 回答
0

我假设它是您尝试访问的 SOAP Web 服务。

您可以在 Soap 组件端点中使用 in-interceptor 和 out-interceptor 组合来记录时间。

1)创建一个 in-interceptor 并向其中添加一个包含时间的属性变量(例如:inTime)
2)创建一个 out-interceptor,您将在其中使用 CurrentTime(减去)inTime 来为您提供所花费的时间。
3)在控制台中记录或显示结果时间或任何方法供您使用计时。

这将是我建议的一种方法。

如果它不是 Web 服务(而您只需要它用于 http 端点)

1)在 HTTP 端点中添加一个用于请求的全局转换器,作为消息属性,存储调用时间
2)另一个用于响应的全局转换器,作为消息属性,在存储响应时间的 HTTP 端点中
3)使用另一个组件(如logger 与 Groovy 表达式)来查找两者之间的差异并显示它

于 2013-10-24T06:21:37.400 回答