mule 中的端点消息通知记录器不会被调用

Endpoint message notification logger in mule does not get invoked

我想记录从我的 HTTP 端点(请求者)发出的有效载荷(集中式记录),我认为最好使用 EndpointMessageNotificationListener

服务器正常启动,但我的通知记录器没有被调用。我希望每次从 HTTP 请求方发出请求时都会调用 onNotification 方法。

现在我已经配置了 spring bean。

<spring:bean name="endpointNotificationLogger" class="EndpointAuditor" />

我的Javaclass如下

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 3.6.1 EE 与新的 HTTP 连接器一起使用,但此特定 Mule 版本中的 HTTP 连接器未实现此功能。

所以基本上我做了所有正确的事情,而 Mule 只是没有这个功能。

但是他们已经用 Mule 3.6.3 EE 和 Mule 3.7.X 实现了它。 commit 展示了代码是如何编写的。