【问题标题】:Intercepting MQTT messages in ActiveMQ Artemis在 ActiveMQ Artemis 中拦截 MQTT 消息
【发布时间】:2020-08-30 08:27:48
【问题描述】:

有人可以指导我如何在 ActiveMQ Artemis 代理上拦截 MQTT 消息吗?我按照手册中的建议进行了尝试,但 MQTT 消息没有被拦截。但是消息的发布和订阅工作正常。

拦截器类:

public class InterceptorExample implements Interceptor {
      @Override
      public boolean intercept(Packet packet, RemotingConnection connection) throws ActiveMQException {
           System.out.println("Packet intercepted");
           return true;
      }
}

我在 addMQTTConnector 方法中将拦截器添加到配置中

protected void addMQTTConnector() throws Exception {        

    .
    .
    .
    List<String> incomingInterceptors = new ArrayList<>();
    incomingInterceptors.add("org.apache.activemq.artemis.core.protocol.mqtt.InterceptorExample");
    server.getConfiguration().setIncomingInterceptorClassNames(incomingInterceptors);

}

代理类的完整代码位于https://codeshare.io/snZsB

【问题讨论】:

    标签: activemq-artemis


    【解决方案1】:

    我 filled a feature request 为 MQTT 中的拦截器支持。它已经实现并在 Artemis 1.4.0 中发布。

    在 Artemis 1.3.0 中,只能拦截通过核心协议(可能还有除 MQTT 之外的其他协议)发送的消息。

    【讨论】:

      猜你喜欢
      • 2022-01-19
      • 1970-01-01
      • 1970-01-01
      • 2021-09-02
      • 1970-01-01
      • 2019-04-02
      • 2021-12-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多