public interface MQTTSubscriptionStrategy
Modifier and Type | Method and Description |
---|---|
MQTTProtocolConverter |
getProtocolConverter() |
MQTTSubscription |
getSubscription(org.apache.activemq.command.ConsumerId consumer)
Lookup an
MQTTSubscription instance based on known ConsumerId value. |
void |
initialize(MQTTProtocolConverter protocol)
Initialize the strategy before first use.
|
boolean |
isControlTopic(org.apache.activemq.command.ActiveMQDestination destination)
Allows the protocol handler to interrogate an destination name to determine if it
is equivalent to the MQTT control topic (starts with $).
|
void |
onConnect(org.fusesource.mqtt.codec.CONNECT connect)
Allows the strategy to perform any needed actions on client connect
prior to the CONNACK frame being sent back such as recovering old
subscriptions and performing any clean session actions.
|
void |
onReSubscribe(MQTTSubscription subscription)
Called when a client sends a duplicate subscribe request which should
force any retained messages on that topic to be replayed again as though
the client had just subscribed for the first time.
|
String |
onSend(org.apache.activemq.command.ActiveMQDestination destination)
Intercepts send operations from the broker and allows the strategy to map the
target topic name so that the client sees a valid Topic name.
|
org.apache.activemq.command.ActiveMQDestination |
onSend(String topicName)
Intercepts PUBLISH operations from the client and allows the strategy to map the
target destination so that the send operation will land in the destinations that
this strategy has mapped the incoming subscribe requests to.
|
byte |
onSubscribe(String topicName,
org.fusesource.mqtt.client.QoS requestedQoS)
Called when a new Subscription is being requested.
|
byte |
onSubscribe(org.fusesource.mqtt.client.Topic topic)
Called for each Topic that a client requests to subscribe to.
|
void |
onUnSubscribe(String topicName)
Called when a client requests an un-subscribe a previous subscription.
|
void |
setProtocolConverter(MQTTProtocolConverter parent)
Sets the
MQTTProtocolConverter that is the parent of this strategy object. |
void initialize(MQTTProtocolConverter protocol) throws MQTTProtocolException
protocol
- the MQTTProtocolConverter that is initializing the strategyMQTTProtocolException
- if an error occurs during initialization.void onConnect(org.fusesource.mqtt.codec.CONNECT connect) throws MQTTProtocolException
MQTTProtocolException
- if an error occurs while processing the connect actions.byte onSubscribe(org.fusesource.mqtt.client.Topic topic) throws MQTTProtocolException
topic
- the MQTT Topic instance being subscribed to.MQTTProtocolException
- if an error occurs while processing the subscribe actions.byte onSubscribe(String topicName, org.fusesource.mqtt.client.QoS requestedQoS) throws MQTTProtocolException
topicName
- the requested Topic name to subscribe to.requestedQoS
- the QoS level that the client has requested for this subscription.MQTTProtocolException
- if an error occurs while processing the subscribe actions.void onReSubscribe(MQTTSubscription subscription) throws MQTTProtocolException
subscription
- the MQTTSubscription that contains the subscription state.MQTTProtocolException
void onUnSubscribe(String topicName) throws MQTTProtocolException
topicName
- the name of the Topic the client wishes to unsubscribe from.MQTTProtocolException
- if an error occurs during the un-subscribe processing.org.apache.activemq.command.ActiveMQDestination onSend(String topicName)
topicName
- the targeted Topic that the client sent the message to.String onSend(org.apache.activemq.command.ActiveMQDestination destination)
destination
- the destination that the message was dispatched fromboolean isControlTopic(org.apache.activemq.command.ActiveMQDestination destination)
destination
- the destination to query.void setProtocolConverter(MQTTProtocolConverter parent)
MQTTProtocolConverter
that is the parent of this strategy object.parent
- the MQTTProtocolConverter
that owns this strategy.MQTTProtocolConverter getProtocolConverter()
MQTTProtocolConverter
that owns this strategy.MQTTSubscription getSubscription(org.apache.activemq.command.ConsumerId consumer)
MQTTSubscription
instance based on known ConsumerId
value.consumer
- the consumer ID to lookup.MQTTSubscription
for the consumer or null if no subscription exists.Copyright © 2005–2018 FuseSource, Corp.. All rights reserved.