我想记录从我的HTTP端点(请求者)发送的有效负载(集中式日志),我认为最好使用EndpointMessageNotificationListener
服务器正确启动,但通知记录器未被调用。我希望每次从HTTP请求者发出请求时都会调用onNotification方法。
现在我已经配置了spring。
<spring:bean name="endpointNotificationLogger" class="EndpointAuditor" />我的Java类如下所示
public class EndpointAuditor implements EndpointMessageNotificationListener<EndpointMessageNotification> {
public EndpointAuditor(){
System.out.println("The EndpointAuditor has been instantiated");
}
@Override
public void onNotification(EndpointMessageNotification notification) {
try {
System.out.println("This comes from the endpoint " + notification.getSource().getPayloadAsString());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}和我的通知配置如下
<notifications>
<notification event="ENDPOINT-MESSAGE" />
<notification-listener ref="endpointNotificationLogger" />
</notifications>我从这里那里捡到了所有这些。
知道为什么Mule不高兴吗?
发布于 2015-08-15 02:43:07
事实证明,这是一个棘手的问题。我在新的HTTP连接器中使用Mule 3.6.1EE,在这个特定的Mule版本中,这个特性不是用HTTP实现的。
基本上,我做了所有正确的事情,而Mule只是没有这个特性。
但是他们已经用Mule 3.6.3EE和Mule 3.7.X实现了它,这个提交展示了如何为它编写代码。
https://stackoverflow.com/questions/31910491
复制相似问题