【发布时间】:2015-08-15 10:43:07
【问题描述】:
我想记录从我的 HTTP 端点(请求者)发出的有效负载(集中式日志记录),我认为最好使用EndpointMessageNotificationListener
服务器正确启动,但我的通知记录器没有被调用。我希望每次从 HTTP 请求者发出请求时都会调用 onNotification 方法。
现在我已经配置好了spring bean。
<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>
这一切都是我从here 那里得到的。
你知道骡不开心的原因吗?
【问题讨论】:
标签: mule