Class MQTTProtocolManager

  • All Implemented Interfaces:
    org.apache.activemq.artemis.core.server.management.NotificationListener, org.apache.activemq.artemis.spi.core.protocol.ProtocolManager<MQTTInterceptor,​MQTTRoutingHandler>

    public class MQTTProtocolManager
    extends org.apache.activemq.artemis.spi.core.protocol.AbstractProtocolManager<io.netty.handler.codec.mqtt.MqttMessage,​MQTTInterceptor,​MQTTConnection,​MQTTRoutingHandler>
    implements org.apache.activemq.artemis.core.server.management.NotificationListener
    • Method Detail

      • getDefaultMqttSessionExpiryInterval

        public int getDefaultMqttSessionExpiryInterval()
      • setDefaultMqttSessionExpiryInterval

        public MQTTProtocolManager setDefaultMqttSessionExpiryInterval​(int sessionExpiryInterval)
      • getTopicAliasMaximum

        public int getTopicAliasMaximum()
      • setTopicAliasMaximum

        public MQTTProtocolManager setTopicAliasMaximum​(int topicAliasMaximum)
      • getReceiveMaximum

        public int getReceiveMaximum()
      • getMaximumPacketSize

        public int getMaximumPacketSize()
      • setMaximumPacketSize

        public MQTTProtocolManager setMaximumPacketSize​(int maximumPacketSize)
      • getServerKeepAlive

        public int getServerKeepAlive()
      • isCloseMqttConnectionOnPublishAuthorizationFailure

        public boolean isCloseMqttConnectionOnPublishAuthorizationFailure()
      • setCloseMqttConnectionOnPublishAuthorizationFailure

        public void setCloseMqttConnectionOnPublishAuthorizationFailure​(boolean closeMqttConnectionOnPublishAuthorizationFailure)
      • onNotification

        public void onNotification​(org.apache.activemq.artemis.core.server.management.Notification notification)
        Specified by:
        onNotification in interface org.apache.activemq.artemis.core.server.management.NotificationListener
      • getFactory

        public org.apache.activemq.artemis.spi.core.protocol.ProtocolManagerFactory getFactory()
        Specified by:
        getFactory in interface org.apache.activemq.artemis.spi.core.protocol.ProtocolManager<MQTTInterceptor,​MQTTRoutingHandler>
      • updateInterceptors

        public void updateInterceptors​(java.util.List incoming,
                                       java.util.List outgoing)
        Specified by:
        updateInterceptors in interface org.apache.activemq.artemis.spi.core.protocol.ProtocolManager<MQTTInterceptor,​MQTTRoutingHandler>
      • scanSessions

        public void scanSessions()
      • createConnectionEntry

        public org.apache.activemq.artemis.spi.core.protocol.ConnectionEntry createConnectionEntry​(org.apache.activemq.artemis.spi.core.remoting.Acceptor acceptorUsed,
                                                                                                   org.apache.activemq.artemis.spi.core.remoting.Connection connection)
        Specified by:
        createConnectionEntry in interface org.apache.activemq.artemis.spi.core.protocol.ProtocolManager<MQTTInterceptor,​MQTTRoutingHandler>
      • acceptsNoHandshake

        public boolean acceptsNoHandshake()
        Specified by:
        acceptsNoHandshake in interface org.apache.activemq.artemis.spi.core.protocol.ProtocolManager<MQTTInterceptor,​MQTTRoutingHandler>
      • handleBuffer

        public void handleBuffer​(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection,
                                 org.apache.activemq.artemis.api.core.ActiveMQBuffer buffer)
        Specified by:
        handleBuffer in interface org.apache.activemq.artemis.spi.core.protocol.ProtocolManager<MQTTInterceptor,​MQTTRoutingHandler>
      • addChannelHandlers

        public void addChannelHandlers​(io.netty.channel.ChannelPipeline pipeline)
        Specified by:
        addChannelHandlers in interface org.apache.activemq.artemis.spi.core.protocol.ProtocolManager<MQTTInterceptor,​MQTTRoutingHandler>
      • isProtocol

        public boolean isProtocol​(byte[] array)
        Relevant portions of the specs we support: MQTT 3.1 - https://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html#connect MQTT 3.1.1 - http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718028 MQTT 5 - https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901033
        Specified by:
        isProtocol in interface org.apache.activemq.artemis.spi.core.protocol.ProtocolManager<MQTTInterceptor,​MQTTRoutingHandler>
      • handshake

        public void handshake​(org.apache.activemq.artemis.core.remoting.impl.netty.NettyServerConnection connection,
                              org.apache.activemq.artemis.api.core.ActiveMQBuffer buffer)
        Specified by:
        handshake in interface org.apache.activemq.artemis.spi.core.protocol.ProtocolManager<MQTTInterceptor,​MQTTRoutingHandler>
      • websocketSubprotocolIdentifiers

        public java.util.List<java.lang.String> websocketSubprotocolIdentifiers()
        Specified by:
        websocketSubprotocolIdentifiers in interface org.apache.activemq.artemis.spi.core.protocol.ProtocolManager<MQTTInterceptor,​MQTTRoutingHandler>
      • invokeIncoming

        public java.lang.String invokeIncoming​(io.netty.handler.codec.mqtt.MqttMessage mqttMessage,
                                               MQTTConnection connection)
      • invokeOutgoing

        public java.lang.String invokeOutgoing​(io.netty.handler.codec.mqtt.MqttMessage mqttMessage,
                                               MQTTConnection connection)
      • isClientConnected

        public boolean isClientConnected​(java.lang.String clientId,
                                         MQTTConnection connection)
      • removeConnectedClient

        public void removeConnectedClient​(java.lang.String clientId)
      • addConnectedClient

        public MQTTConnection addConnectedClient​(java.lang.String clientId,
                                                 MQTTConnection connection)
        Parameters:
        clientId -
        connection -
        Returns:
        the MQTTConnection that the added connection replaced or null if there was no previous entry for the clientId
      • getSessionState

        public MQTTSessionState getSessionState​(java.lang.String clientId)
      • removeSessionState

        public MQTTSessionState removeSessionState​(java.lang.String clientId)
      • getSessionStates

        public java.util.Map<java.lang.String,​MQTTSessionState> getSessionStates()
      • getConnectedClients

        public java.util.Map<java.lang.String,​MQTTConnection> getConnectedClients()
        For DEBUG only