Class MQTTSubscription


  • public class MQTTSubscription
    extends Object
    Keeps track of the MQTT client subscription so that acking is correctly done.
    • Constructor Summary

      Constructors 
      Constructor Description
      MQTTSubscription​(MQTTProtocolConverter protocolConverter, String topicName, org.fusesource.mqtt.client.QoS qos, org.apache.activemq.command.ConsumerInfo consumerInfo)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.activemq.command.MessageAck createMessageAck​(org.apache.activemq.command.MessageDispatch md)
      Create a MessageAck that will acknowledge the given MessageDispatch.
      org.fusesource.mqtt.codec.PUBLISH createPublish​(org.apache.activemq.command.ActiveMQMessage message)
      Creates a PUBLISH command that can be sent to a remote client from an incoming ActiveMQMessage instance.
      boolean expectAck​(org.fusesource.mqtt.codec.PUBLISH publish)
      Given a PUBLISH command determine if it will expect an ACK based on the QoS of the Publish command and the QoS of this subscription.
      org.apache.activemq.command.ConsumerInfo getConsumerInfo()
      Gets the ConsumerInfo that describes the subscription sent to ActiveMQ.
      org.apache.activemq.command.ActiveMQDestination getDestination()
      The real ActiveMQDestination that this subscription is assigned.
      org.fusesource.mqtt.client.QoS getQoS()  
      String getTopicName()  
      String toString()  
    • Constructor Detail

      • MQTTSubscription

        public MQTTSubscription​(MQTTProtocolConverter protocolConverter,
                                String topicName,
                                org.fusesource.mqtt.client.QoS qos,
                                org.apache.activemq.command.ConsumerInfo consumerInfo)
    • Method Detail

      • createMessageAck

        public org.apache.activemq.command.MessageAck createMessageAck​(org.apache.activemq.command.MessageDispatch md)
        Create a MessageAck that will acknowledge the given MessageDispatch.
        Parameters:
        md - the MessageDispatch to acknowledge.
        Returns:
        a new MessageAck command to acknowledge the message.
      • createPublish

        public org.fusesource.mqtt.codec.PUBLISH createPublish​(org.apache.activemq.command.ActiveMQMessage message)
                                                        throws DataFormatException,
                                                               IOException,
                                                               JMSException
        Creates a PUBLISH command that can be sent to a remote client from an incoming ActiveMQMessage instance.
        Parameters:
        message - the message to convert to a PUBLISH command.
        Returns:
        a new PUBLISH command that is populated from the ActiveMQMessage.
        Throws:
        DataFormatException
        IOException
        JMSException
      • expectAck

        public boolean expectAck​(org.fusesource.mqtt.codec.PUBLISH publish)
        Given a PUBLISH command determine if it will expect an ACK based on the QoS of the Publish command and the QoS of this subscription.
        Parameters:
        publish - The publish command to inspect.
        Returns:
        true if the client will expect an PUBACK for this PUBLISH.
      • getTopicName

        public String getTopicName()
      • getDestination

        public org.apache.activemq.command.ActiveMQDestination getDestination()
        The real ActiveMQDestination that this subscription is assigned.
        Returns:
        the real ActiveMQDestination assigned to this subscription.
      • getConsumerInfo

        public org.apache.activemq.command.ConsumerInfo getConsumerInfo()
        Gets the ConsumerInfo that describes the subscription sent to ActiveMQ.
        Returns:
        the ConsumerInfo used to create this subscription.
      • getQoS

        public org.fusesource.mqtt.client.QoS getQoS()
        Returns:
        the assigned QoS value for this subscription.