Class MQTTSubscription
java.lang.Object
org.apache.activemq.transport.mqtt.MQTTSubscription
Keeps track of the MQTT client subscription so that acking is correctly done.
-
Constructor Summary
ConstructorsConstructorDescriptionMQTTSubscription
(MQTTProtocolConverter protocolConverter, String topicName, org.fusesource.mqtt.client.QoS qos, org.apache.activemq.command.ConsumerInfo consumerInfo) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.activemq.command.MessageAck
createMessageAck
(org.apache.activemq.command.MessageDispatch md) Create aMessageAck
that will acknowledge the givenMessageDispatch
.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 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.org.apache.activemq.command.ConsumerInfo
Gets theConsumerInfo
that describes the subscription sent to ActiveMQ.org.apache.activemq.command.ActiveMQDestination
The realActiveMQDestination
that this subscription is assigned.org.fusesource.mqtt.client.QoS
getQoS()
toString()
-
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 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(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 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
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
-
getDestination
public org.apache.activemq.command.ActiveMQDestination getDestination()The realActiveMQDestination
that this subscription is assigned.- Returns:
- the real
ActiveMQDestination
assigned to this subscription.
-
getConsumerInfo
public org.apache.activemq.command.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.
-
toString
-