Class MQTTSubscription

java.lang.Object
org.apache.activemq.transport.mqtt.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

    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
    Gets the ConsumerInfo that describes the subscription sent to ActiveMQ.
    org.apache.activemq.command.ActiveMQDestination
    The real ActiveMQDestination that this subscription is assigned.
    org.fusesource.mqtt.client.QoS
     
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MQTTSubscription

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

    • 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, jakarta.jms.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
      jakarta.jms.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.
    • toString

      public String toString()
      Overrides:
      toString in class Object