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 MessageAck
createMessageAck(MessageDispatch md)
Create aMessageAck
that will acknowledge the givenMessageDispatch
.org.fusesource.mqtt.codec.PUBLISH
createPublish(ActiveMQMessage message)
Creates a PUBLISH command that can be sent to a remote client from an incomingActiveMQMessage
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.ConsumerInfo
getConsumerInfo()
Gets theConsumerInfo
that describes the subscription sent to ActiveMQ.ActiveMQDestination
getDestination()
The realActiveMQDestination
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, ConsumerInfo consumerInfo)
-
-
Method Detail
-
createMessageAck
public MessageAck createMessageAck(MessageDispatch md)
Create aMessageAck
that will acknowledge the givenMessageDispatch
.- Parameters:
md
- theMessageDispatch
to acknowledge.- Returns:
- a new
MessageAck
command 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 incomingActiveMQMessage
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 ActiveMQDestination getDestination()
The realActiveMQDestination
that this subscription is assigned.- Returns:
- the real
ActiveMQDestination
assigned to this subscription.
-
getConsumerInfo
public ConsumerInfo getConsumerInfo()
Gets theConsumerInfo
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.
-
-