Class MQTTTransportFilter

java.lang.Object
org.apache.activemq.transport.TransportFilter
org.apache.activemq.transport.mqtt.MQTTTransportFilter
All Implemented Interfaces:
org.apache.activemq.Service, MQTTTransport, Transport, TransportListener

public class MQTTTransportFilter extends TransportFilter implements MQTTTransport
The MQTTTransportFilter normally sits on top of a TcpTransport that has been configured with the StompWireFormat and is used to convert MQTT commands to ActiveMQ commands. All of the conversion work is done by delegating to the MQTTProtocolConverter
  • Constructor Details

    • MQTTTransportFilter

      public MQTTTransportFilter(Transport next, org.apache.activemq.wireformat.WireFormat wireFormat, BrokerService brokerService)
  • Method Details

    • oneway

      public void oneway(Object o) throws IOException
      Specified by:
      oneway in interface Transport
      Overrides:
      oneway in class TransportFilter
      Throws:
      IOException
    • onCommand

      public void onCommand(Object command)
      Specified by:
      onCommand in interface TransportListener
      Overrides:
      onCommand in class TransportFilter
    • sendToActiveMQ

      public void sendToActiveMQ(org.apache.activemq.command.Command command)
      Specified by:
      sendToActiveMQ in interface MQTTTransport
    • sendToMQTT

      public void sendToMQTT(org.fusesource.mqtt.codec.MQTTFrame command) throws IOException
      Specified by:
      sendToMQTT in interface MQTTTransport
      Throws:
      IOException
    • start

      public void start() throws Exception
      Specified by:
      start in interface org.apache.activemq.Service
      Overrides:
      start in class TransportFilter
      Throws:
      Exception
    • stop

      public void stop() throws Exception
      Specified by:
      stop in interface MQTTTransport
      Specified by:
      stop in interface org.apache.activemq.Service
      Overrides:
      stop in class TransportFilter
      Throws:
      Exception
    • getPeerCertificates

      public X509Certificate[] getPeerCertificates()
      Specified by:
      getPeerCertificates in interface MQTTTransport
      Specified by:
      getPeerCertificates in interface Transport
      Overrides:
      getPeerCertificates in class TransportFilter
    • isTrace

      public boolean isTrace()
    • setTrace

      public void setTrace(boolean trace)
    • getInactivityMonitor

      public MQTTInactivityMonitor getInactivityMonitor()
      Specified by:
      getInactivityMonitor in interface MQTTTransport
    • setInactivityMonitor

      public void setInactivityMonitor(MQTTInactivityMonitor monitor)
    • getWireFormat

      public MQTTWireFormat getWireFormat()
      Specified by:
      getWireFormat in interface MQTTTransport
      Specified by:
      getWireFormat in interface Transport
      Overrides:
      getWireFormat in class TransportFilter
    • onException

      public void onException(IOException error)
      Specified by:
      onException in interface MQTTTransport
      Specified by:
      onException in interface TransportListener
      Overrides:
      onException in class TransportFilter
    • getDefaultKeepAlive

      public long getDefaultKeepAlive()
    • setDefaultKeepAlive

      public void setDefaultKeepAlive(long defaultHeartBeat)
    • getConnectAttemptTimeout

      public long getConnectAttemptTimeout()
      Returns:
      the timeout value used to fail a connection if no CONNECT frame read.
    • setConnectAttemptTimeout

      public void setConnectAttemptTimeout(long connectTimeout)
      Sets the timeout value used to fail a connection if no CONNECT frame is read in the given interval.
      Parameters:
      connectTimeout - the connection frame received timeout value.
    • getPublishDollarTopics

      public boolean getPublishDollarTopics()
    • setPublishDollarTopics

      public void setPublishDollarTopics(boolean publishDollarTopics)
    • getSubscriptionStrategy

      public String getSubscriptionStrategy()
    • setSubscriptionStrategy

      public void setSubscriptionStrategy(String name)
    • getActiveMQSubscriptionPrefetch

      public int getActiveMQSubscriptionPrefetch()
    • setActiveMQSubscriptionPrefetch

      public void setActiveMQSubscriptionPrefetch(int activeMQSubscriptionPrefetch)
      set the default prefetch size when mapping the MQTT subscription to an ActiveMQ one The default = 1
      Parameters:
      activeMQSubscriptionPrefetch - set the prefetch for the corresponding ActiveMQ subscription
    • getMaxFrameSize

      public int getMaxFrameSize()
      Returns:
      the maximum number of bytes a single MQTT message frame is allowed to be.
    • setMaxFrameSize

      public void setMaxFrameSize(int maxFrameSize)
      Sets the maximum frame size for an incoming MQTT frame. The protocl limit is 256 megabytes and this value cannot be set higher.
      Parameters:
      maxFrameSize - the maximum allowed frame size for a single MQTT frame.
    • setPeerCertificates

      public void setPeerCertificates(X509Certificate[] certificates)
      Specified by:
      setPeerCertificates in interface MQTTTransport
      Specified by:
      setPeerCertificates in interface Transport
      Overrides:
      setPeerCertificates in class TransportFilter