Search code examples
mqttinterceptorpahobrokeractivemq-artemis

Artemis broker Intercept mqtt client connection


I added a mqtt interceptor into my artemis broker in order to intercept mqtt client connection:

  public class SimpleMQTTInterceptor implements MQTTInterceptor 
  { 

    @Override 
    public boolean intercept(final MqttMessage mqttMessage, RemotingConnection connection) throws ActiveMQException 
    { 

            System.out.println("MQTT Interceptor gets called "); 

            if (mqttMessage instanceof MqttConnectMessage) 
            { 
                    System.out.println("MQTT connection intercepted "); 
            } 
            return true; 
    } 

My client apache paho connect to the broker via this port "ws://0.0.0.0:61614".
My problem is that only message published to topics are intercepted.
Why this doesn't intercept CONNECT message ?


Solution

  • The current version of ActiveMQ Artemis, 2.2.0, at the time I write this response, only supports intercepting MQTT Publish control packets. I opened a pull request adding that feature, therefore, it should be present on future versions.