Class MQTTTransportFilter
java.lang.Object
org.apache.activemq.transport.TransportFilter
org.apache.activemq.transport.mqtt.MQTTTransportFilter
- All Implemented Interfaces:
org.apache.activemq.Service
,MQTTTransport
,Transport
,TransportListener
The MQTTTransportFilter normally sits on top of a TcpTransport that has been
configured with the StompWireFormat and is used to convert MQTT commands to
ActiveMQ commands. All of the conversion work is done by delegating to the
MQTTProtocolConverter
-
Field Summary
Fields inherited from class org.apache.activemq.transport.TransportFilter
next, transportListener
-
Constructor Summary
ConstructorDescriptionMQTTTransportFilter
(Transport next, org.apache.activemq.wireformat.WireFormat wireFormat, BrokerService brokerService) -
Method Summary
Modifier and TypeMethodDescriptionint
long
long
int
boolean
boolean
isTrace()
void
void
void
onException
(IOException error) void
sendToActiveMQ
(org.apache.activemq.command.Command command) void
sendToMQTT
(org.fusesource.mqtt.codec.MQTTFrame command) void
setActiveMQSubscriptionPrefetch
(int activeMQSubscriptionPrefetch) set the default prefetch size when mapping the MQTT subscription to an ActiveMQ one The default = 1void
setConnectAttemptTimeout
(long connectTimeout) Sets the timeout value used to fail a connection if no CONNECT frame is read in the given interval.void
setDefaultKeepAlive
(long defaultHeartBeat) void
void
setMaxFrameSize
(int maxFrameSize) Sets the maximum frame size for an incoming MQTT frame.void
setPeerCertificates
(X509Certificate[] certificates) void
setPublishDollarTopics
(boolean publishDollarTopics) void
void
setTrace
(boolean trace) void
start()
void
stop()
Methods inherited from class org.apache.activemq.transport.TransportFilter
asyncRequest, getNext, getReceiveCounter, getRemoteAddress, getTransportListener, isConnected, isDisposed, isFaultTolerant, isReconnectSupported, isUpdateURIsSupported, narrow, reconnect, request, request, setTransportListener, toString, transportInterupted, transportResumed, updateURIs
-
Constructor Details
-
MQTTTransportFilter
public MQTTTransportFilter(Transport next, org.apache.activemq.wireformat.WireFormat wireFormat, BrokerService brokerService)
-
-
Method Details
-
oneway
- Specified by:
oneway
in interfaceTransport
- Overrides:
oneway
in classTransportFilter
- Throws:
IOException
-
onCommand
- Specified by:
onCommand
in interfaceTransportListener
- Overrides:
onCommand
in classTransportFilter
-
sendToActiveMQ
public void sendToActiveMQ(org.apache.activemq.command.Command command) - Specified by:
sendToActiveMQ
in interfaceMQTTTransport
-
sendToMQTT
- Specified by:
sendToMQTT
in interfaceMQTTTransport
- Throws:
IOException
-
start
- Specified by:
start
in interfaceorg.apache.activemq.Service
- Overrides:
start
in classTransportFilter
- Throws:
Exception
-
stop
- Specified by:
stop
in interfaceMQTTTransport
- Specified by:
stop
in interfaceorg.apache.activemq.Service
- Overrides:
stop
in classTransportFilter
- Throws:
Exception
-
getPeerCertificates
- Specified by:
getPeerCertificates
in interfaceMQTTTransport
- Specified by:
getPeerCertificates
in interfaceTransport
- Overrides:
getPeerCertificates
in classTransportFilter
-
isTrace
public boolean isTrace() -
setTrace
public void setTrace(boolean trace) -
getInactivityMonitor
- Specified by:
getInactivityMonitor
in interfaceMQTTTransport
-
setInactivityMonitor
-
getWireFormat
- Specified by:
getWireFormat
in interfaceMQTTTransport
- Specified by:
getWireFormat
in interfaceTransport
- Overrides:
getWireFormat
in classTransportFilter
-
onException
- Specified by:
onException
in interfaceMQTTTransport
- Specified by:
onException
in interfaceTransportListener
- Overrides:
onException
in classTransportFilter
-
getDefaultKeepAlive
public long getDefaultKeepAlive() -
setDefaultKeepAlive
public void setDefaultKeepAlive(long defaultHeartBeat) -
getConnectAttemptTimeout
public long getConnectAttemptTimeout()- Returns:
- the timeout value used to fail a connection if no CONNECT frame read.
-
setConnectAttemptTimeout
public void setConnectAttemptTimeout(long connectTimeout) Sets the timeout value used to fail a connection if no CONNECT frame is read in the given interval.- Parameters:
connectTimeout
- the connection frame received timeout value.
-
getPublishDollarTopics
public boolean getPublishDollarTopics() -
setPublishDollarTopics
public void setPublishDollarTopics(boolean publishDollarTopics) -
getSubscriptionStrategy
-
setSubscriptionStrategy
-
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
-
getMaxFrameSize
public int getMaxFrameSize()- Returns:
- the maximum number of bytes a single MQTT message frame is allowed to be.
-
setMaxFrameSize
public void setMaxFrameSize(int maxFrameSize) Sets the maximum frame size for an incoming MQTT frame. The protocl limit is 256 megabytes and this value cannot be set higher.- Parameters:
maxFrameSize
- the maximum allowed frame size for a single MQTT frame.
-
setPeerCertificates
- Specified by:
setPeerCertificates
in interfaceMQTTTransport
- Specified by:
setPeerCertificates
in interfaceTransport
- Overrides:
setPeerCertificates
in classTransportFilter
-