Class MQTTProtocolConverter
- java.lang.Object
-
- org.apache.activemq.transport.mqtt.MQTTProtocolConverter
-
public class MQTTProtocolConverter extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
MULTI_LEVEL_WILDCARD
static String
QOS_PROPERTY_NAME
static String
SINGLE_LEVEL_WILDCARD
static int
V3_1
static int
V3_1_1
int
version
-
Constructor Summary
Constructors Constructor Description MQTTProtocolConverter(MQTTTransport mqttTransport, BrokerService brokerService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
containsMqttWildcard(String value)
org.fusesource.mqtt.codec.PUBLISH
convertMessage(org.apache.activemq.command.ActiveMQMessage message)
protected MQTTSubscriptionStrategy
findSubscriptionStrategy()
int
getActiveMQSubscriptionPrefetch()
String
getClientId()
org.apache.activemq.command.ConnectionId
getConnectionId()
long
getDefaultKeepAlive()
MQTTTransport
getMQTTTransport()
MQTTPacketIdGenerator
getPacketIdGenerator()
boolean
getPublishDollarTopics()
org.apache.activemq.command.SessionId
getSessionId()
String
getSubscriptionStrategy()
boolean
isCleanSession()
void
onActiveMQCommand(org.apache.activemq.command.Command command)
Dispatch an ActiveMQ commandvoid
onMQTTCommand(org.fusesource.mqtt.codec.MQTTFrame frame)
Convert a MQTT commandvoid
onTransportError()
void
onUnSubscribe(org.fusesource.mqtt.codec.UNSUBSCRIBE command)
void
sendToActiveMQ(org.apache.activemq.command.Command command, ResponseHandler handler)
void
setActiveMQSubscriptionPrefetch(int activeMQSubscriptionPrefetch)
set the default prefetch size when mapping the MQTT subscription to an ActiveMQ one The default = 1void
setDefaultKeepAlive(long keepAlive)
Set the default keep alive time (in milliseconds) that would be used if configured on server side and the client sends a keep-alive value of 0 (zero) on a CONNECT framevoid
setPublishDollarTopics(boolean publishDollarTopics)
void
setSubsciptionStrategy(MQTTSubscriptionStrategy subsciptionStrategy)
void
setSubscriptionStrategy(String name)
-
-
-
Field Detail
-
QOS_PROPERTY_NAME
public static final String QOS_PROPERTY_NAME
- See Also:
- Constant Field Values
-
V3_1
public static final int V3_1
- See Also:
- Constant Field Values
-
V3_1_1
public static final int V3_1_1
- See Also:
- Constant Field Values
-
SINGLE_LEVEL_WILDCARD
public static final String SINGLE_LEVEL_WILDCARD
- See Also:
- Constant Field Values
-
MULTI_LEVEL_WILDCARD
public static final String MULTI_LEVEL_WILDCARD
- See Also:
- Constant Field Values
-
version
public int version
-
-
Constructor Detail
-
MQTTProtocolConverter
public MQTTProtocolConverter(MQTTTransport mqttTransport, BrokerService brokerService)
-
-
Method Detail
-
sendToActiveMQ
public void sendToActiveMQ(org.apache.activemq.command.Command command, ResponseHandler handler)
-
onMQTTCommand
public void onMQTTCommand(org.fusesource.mqtt.codec.MQTTFrame frame) throws IOException, JMSException
Convert a MQTT command- Throws:
IOException
JMSException
-
onUnSubscribe
public void onUnSubscribe(org.fusesource.mqtt.codec.UNSUBSCRIBE command) throws MQTTProtocolException
- Throws:
MQTTProtocolException
-
onActiveMQCommand
public void onActiveMQCommand(org.apache.activemq.command.Command command) throws Exception
Dispatch an ActiveMQ command- Throws:
Exception
-
convertMessage
public org.fusesource.mqtt.codec.PUBLISH convertMessage(org.apache.activemq.command.ActiveMQMessage message) throws IOException, JMSException, DataFormatException
-
getMQTTTransport
public MQTTTransport getMQTTTransport()
-
onTransportError
public void onTransportError()
-
getDefaultKeepAlive
public long getDefaultKeepAlive()
-
setDefaultKeepAlive
public void setDefaultKeepAlive(long keepAlive)
Set the default keep alive time (in milliseconds) that would be used if configured on server side and the client sends a keep-alive value of 0 (zero) on a CONNECT frame- Parameters:
keepAlive
- the keepAlive in milliseconds
-
getActiveMQSubscriptionPrefetch
public int getActiveMQSubscriptionPrefetch()
-
setActiveMQSubscriptionPrefetch
public void setActiveMQSubscriptionPrefetch(int activeMQSubscriptionPrefetch)
set the default prefetch size when mapping the MQTT subscription to an ActiveMQ one The default = 1- Parameters:
activeMQSubscriptionPrefetch
- set the prefetch for the corresponding ActiveMQ subscription
-
getPacketIdGenerator
public MQTTPacketIdGenerator getPacketIdGenerator()
-
setPublishDollarTopics
public void setPublishDollarTopics(boolean publishDollarTopics)
-
getPublishDollarTopics
public boolean getPublishDollarTopics()
-
getConnectionId
public org.apache.activemq.command.ConnectionId getConnectionId()
-
getSessionId
public org.apache.activemq.command.SessionId getSessionId()
-
isCleanSession
public boolean isCleanSession()
-
getSubscriptionStrategy
public String getSubscriptionStrategy()
-
setSubscriptionStrategy
public void setSubscriptionStrategy(String name)
-
getClientId
public String getClientId()
-
containsMqttWildcard
protected boolean containsMqttWildcard(String value)
-
findSubscriptionStrategy
protected MQTTSubscriptionStrategy findSubscriptionStrategy() throws IOException
- Throws:
IOException
-
setSubsciptionStrategy
public void setSubsciptionStrategy(MQTTSubscriptionStrategy subsciptionStrategy)
-
-