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, ConsumerInfo consumerInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageAckcreateMessageAck(MessageDispatch md)Create aMessageAckthat will acknowledge the givenMessageDispatch.org.fusesource.mqtt.codec.PUBLISHcreatePublish(ActiveMQMessage message)Creates a PUBLISH command that can be sent to a remote client from an incomingActiveMQMessageinstance.booleanexpectAck(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.ConsumerInfogetConsumerInfo()Gets theConsumerInfothat describes the subscription sent to ActiveMQ.ActiveMQDestinationgetDestination()The realActiveMQDestinationthat this subscription is assigned.org.fusesource.mqtt.client.QoSgetQoS()StringgetTopicName()StringtoString()
-
-
-
Constructor Detail
-
MQTTSubscription
public MQTTSubscription(MQTTProtocolConverter protocolConverter, String topicName, org.fusesource.mqtt.client.QoS qos, ConsumerInfo consumerInfo)
-
-
Method Detail
-
createMessageAck
public MessageAck createMessageAck(MessageDispatch md)
Create aMessageAckthat will acknowledge the givenMessageDispatch.- Parameters:
md- theMessageDispatchto acknowledge.- Returns:
- a new
MessageAckcommand to acknowledge the message.
-
createPublish
public org.fusesource.mqtt.codec.PUBLISH createPublish(ActiveMQMessage message) throws DataFormatException, IOException, JMSException
Creates a PUBLISH command that can be sent to a remote client from an incomingActiveMQMessageinstance.- Parameters:
message- the message to convert to a PUBLISH command.- Returns:
- a new PUBLISH command that is populated from the
ActiveMQMessage. - Throws:
DataFormatExceptionIOExceptionJMSException
-
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 ActiveMQDestination getDestination()
The realActiveMQDestinationthat this subscription is assigned.- Returns:
- the real
ActiveMQDestinationassigned to this subscription.
-
getConsumerInfo
public ConsumerInfo getConsumerInfo()
Gets theConsumerInfothat describes the subscription sent to ActiveMQ.- Returns:
- the
ConsumerInfoused to create this subscription.
-
getQoS
public org.fusesource.mqtt.client.QoS getQoS()
- Returns:
- the assigned QoS value for this subscription.
-
-