【问题标题】:Endpoint message notification logger in mule does not get invoked未调用 mule 中的端点消息通知记录器
【发布时间】: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


    【解决方案1】:

    结果证明这是一个棘手的问题。我使用的是带有新 HTTP 连接器的 Mule 3.6.1 EE,但在这个特定的 Mule 版本中,此功能未通过 HTTP 连接器实现。

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

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

    【讨论】:

      猜你喜欢
      • 2014-09-11
      • 1970-01-01
      • 2016-03-02
      • 1970-01-01
      • 1970-01-01
      • 2013-09-02
      • 1970-01-01
      • 1970-01-01
      • 2019-03-25
      相关资源
      最近更新 更多