Class MQTTForward
java.lang.Object
javaforce.MQTTForward
MQTT Forward.
Provides a queue of messages to be sent to an MQTT service.
MQTTForward will work in the background to send messages.
- Author:
- peter.quiring
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns # of times a connection was created.booleanReturns connection status.voidvoidForce a reconnection to MQTT Server.voidsetKeepAlive(int value) Set keep alive interval in seconds (default = 5) (0 = disabled) Send a ping() to maintain connection.voidsetMaxQueueSize(int size) Set maximum queue size (default = 1000) Messages are lost when queue reaches this size.voidsetQOS(byte qos) Set QOS (Quality of service) QOS effects publish acknowledgements.voidStart sending messages to MQTT Server on host:port without encryption.voidStart sending messages to MQTT Server on host:port without encryption with supplied login details.voidStart sending messages to MQTT Server on host:port with encryption.voidStart sending messages to MQTT Server on host:port with encryption.voidStart sending messages to MQTT Server on host without encryption with supplied login details.voidStart sending messages to MQTT Server on host with encryption with supplied login details.voidstop()Stop forwarding messages and shutdown any connection.
-
Constructor Details
-
MQTTForward
public MQTTForward()
-
-
Method Details
-
start
Start sending messages to MQTT Server on host:port without encryption. -
start
-
start
-
start
-
start
-
start
-
stop
public void stop()Stop forwarding messages and shutdown any connection. -
isConnected
public boolean isConnected()Returns connection status. -
getConnects
public int getConnects()Returns # of times a connection was created. -
setMaxQueueSize
public void setMaxQueueSize(int size) Set maximum queue size (default = 1000) Messages are lost when queue reaches this size. -
setQOS
public void setQOS(byte qos) Set QOS (Quality of service) QOS effects publish acknowledgements. QOS values are defined in javaforce.service.MQTTServer QOS_0 = NO ACK QOS_1 = ACK QOS_2 = REC, REL, CMP QOS_3 = reserved- Parameters:
qos- = quality of service (default = QOS_1)
-
publish
-
setKeepAlive
public void setKeepAlive(int value) Set keep alive interval in seconds (default = 5) (0 = disabled) Send a ping() to maintain connection. -
reconnect
public void reconnect()Force a reconnection to MQTT Server.
-