activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gupta Bharat <>
Subject Intercept mqtt client connection
Date Thu, 14 Dec 2017 07:44:31 GMT

I want to intercept clients when trying to connect in order to do some checks before allowing
them to connect.
How could I add needed features to Artemis broker interceptor? Is this possible in ActiveMQ?

I have written following code which is not working on connecting the activemq broker with
MQTT client.

import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.core.protocol.mqtt.MQTTInterceptor;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.log4j.Logger;

import io.netty.handler.codec.mqtt.MqttConnectMessage;
import io.netty.handler.codec.mqtt.MqttMessage;

public class MyInterceptors implements MQTTInterceptor {

      final static Logger logger = Logger.getLogger(MyBroker.class);

      public boolean intercept(MqttMessage arg0, RemotingConnection arg1) throws ActiveMQException

  "MQTT Interceptor gets called--------------------------------------------------------------");

          if (arg0 instanceof MqttConnectMessage)
        "MQTT Interceptor gets called--------------------------------------------------------------");
          return true;



Bharat Gupta
Development & Support | Platform Technician, IXCB | Scania IT
Mobile: +46700869007, +91-9718483802<>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message