Hello,

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);

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

            logger.info("MQTT Interceptor gets 
called--------------------------------------------------------------");


          if (arg0 instanceof MqttConnectMessage)
          {
                  logger.info("MQTT Interceptor gets 
called--------------------------------------------------------------");
          }
          return true;

      }

}



Regards,
Bharat Gupta
Development & Support | Platform Technician, IXCB | Scania IT
Mobile: +46700869007, +91-9718483802
bharat.gu...@scania.com<mailto:bharat.gu...@scania.com>

Reply via email to