public class MqttConnectOptions extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MQTT_VERSION_3_1_1
Mqtt Version 3.1.1
|
Constructor and Description |
---|
MqttConnectOptions()
Constructs a new
MqttConnectOptions object using the default
values. |
Modifier and Type | Method and Description |
---|---|
int |
getConnectionTimeout()
Returns the connection timeout value.
|
int |
getKeepAliveInterval()
Returns the "keep alive" interval.
|
byte[] |
getLWTPayload() |
int |
getLWTQos() |
boolean |
getLWTRetained() |
String |
getLWTTopic() |
int |
getMaxInflight()
Returns the "max inflight".
|
int |
getMqttVersion()
Returns the MQTT version.
|
String |
getPassword()
Returns the password to use for the connection.
|
String |
getUserName()
Returns the user name to use for the connection.
|
boolean |
isAutomaticReconnect()
Returns whether the client will automatically attempt to reconnect to the
server if the connection is lost
|
boolean |
isCleanSession()
Returns whether the client and server should remember state for the client
across reconnects.
|
void |
setAutomaticReconnect(boolean automaticReconnect)
Sets whether the client will automatically attempt to reconnect to the server
if the connection is lost.
|
void |
setCleanSession(boolean cleanSession)
Sets whether the client and server should remember state across restarts and
reconnects.
|
void |
setConnectionTimeout(int connectionTimeout)
Sets the connection timeout value.
|
void |
setKeepAliveInterval(int keepAliveInterval)
Sets the "keep alive" interval.
|
void |
setMaxInflight(int maxInflight)
Sets the "max inflight".
|
void |
setPassword(String password)
Sets the password to use for the connection.
|
void |
setUserName(String userName)
Sets the user name to use for the connection.
|
void |
setWill(String topic,
byte[] payload,
int qos,
boolean retained)
Sets the "Last Will and Testament" (LWT) for the connection.
|
String |
toString() |
static int |
validateURI(String srvURI)
Validate a URI
|
public static final int MQTT_VERSION_3_1_1
public MqttConnectOptions()
MqttConnectOptions
object using the default
values.
The defaults are:
public int getConnectionTimeout()
setConnectionTimeout(int)
public int getKeepAliveInterval()
setKeepAliveInterval(int)
public byte[] getLWTPayload()
public int getLWTQos()
public boolean getLWTRetained()
public String getLWTTopic()
public int getMaxInflight()
setMaxInflight(int)
public int getMqttVersion()
public String getPassword()
public String getUserName()
public boolean isAutomaticReconnect()
public boolean isCleanSession()
public void setAutomaticReconnect(boolean automaticReconnect)
automaticReconnect
- If set to True, Automatic Reconnect will be enabledpublic void setCleanSession(boolean cleanSession)
cleanSession
- Set to True to enable cleanSessionpublic void setConnectionTimeout(int connectionTimeout)
connectionTimeout
- the timeout value, measured in seconds. It must be >0;public void setKeepAliveInterval(int keepAliveInterval) throws IllegalArgumentException
The default value is 60 seconds
keepAliveInterval
- the interval, measured in seconds, must be >= 0.IllegalArgumentException
- if the keepAliveInterval was invalidpublic void setMaxInflight(int maxInflight)
The default value is 10
maxInflight
- the number of maxInfligt messagespublic void setPassword(String password)
password
- A Char Array of the passwordpublic void setUserName(String userName)
userName
- The Username as a StringIllegalArgumentException
- if the user name is blank or only contains whitespace characters.public void setWill(String topic, byte[] payload, int qos, boolean retained)
topic
- the topic to publish to.payload
- the byte payload for the message.qos
- the quality of service to publish the message at (0, 1 or 2).retained
- whether or not the message should be retained.public static int validateURI(String srvURI)
srvURI
- The Server URI