|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.xenqtt.client.MqttClientConfig
public final class MqttClientConfig
Use this class to configure the MqttClient
implementations and the MqttClientFactory
. This is an advanced operation. The defaults should be
fine for most cases.
Constructor Summary | |
---|---|
MqttClientConfig()
|
Method Summary | |
---|---|
MqttClientConfig |
clone()
|
int |
getBlockingTimeoutSeconds()
|
int |
getConnectTimeoutMillis()
|
int |
getConnectTimeoutSeconds()
|
int |
getKeepAliveSeconds()
|
int |
getMessageResendIntervalSeconds()
|
ReconnectionStrategy |
getReconnectionStrategy()
|
MqttClientConfig |
setBlockingTimeoutSeconds(int blockingTimeoutSeconds)
|
MqttClientConfig |
setConnectTimeoutSeconds(int connectTimeoutSeconds)
|
MqttClientConfig |
setKeepAliveSeconds(int keepAliveSeconds)
|
MqttClientConfig |
setMessageResendIntervalSeconds(int messageResendIntervalSeconds)
|
MqttClientConfig |
setReconnectionStrategy(ReconnectionStrategy reconnectionStrategy)
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MqttClientConfig()
Method Detail |
---|
public ReconnectionStrategy getReconnectionStrategy()
Defaults to a ProgressiveReconnectionStrategy
where the initial reconnection attempt happens after 50 millis then increases by a factor
of 5 up to 30 seconds where it continues to retry indefinitely.
public MqttClientConfig setReconnectionStrategy(ReconnectionStrategy reconnectionStrategy)
reconnectionStrategy
- The algorithm used to reconnect to the broker if the connection is lost.
Defaults to a ProgressiveReconnectionStrategy
where the initial reconnection attempt happens after 50 millis then increases by a
factor of 5 up to 30 seconds where it continues to retry indefinitely.
public int getConnectTimeoutSeconds()
ack
to a connect message
before timing out and closing the channel. 0 to
wait forever.
Defaults to 30 seconds.
public int getConnectTimeoutMillis()
getConnectTimeoutSeconds()
converted to millisecondspublic MqttClientConfig setConnectTimeoutSeconds(int connectTimeoutSeconds)
connectTimeoutSeconds
- Seconds to wait for an ack
to a connect message
before timing out and closing the channel. 0 to
wait forever.
Defaults to 30 seconds.
public int getMessageResendIntervalSeconds()
MqttMessage.isAckable()
. The minimum allowable value for this setting is 2.
Defaults to 30 seconds.
public MqttClientConfig setMessageResendIntervalSeconds(int messageResendIntervalSeconds)
messageResendIntervalSeconds
- Seconds between attempts to resend a message that is MqttMessage.isAckable()
. The minimum allowable value for this setting is 2.
Defaults to 30 seconds.
public int getBlockingTimeoutSeconds()
MqttTimeoutException
is thrown. 0 will wait forever. Applies only to
synchronous clients. It is ignored by asynchronous clients.
Defaults to 0 (wait forever).
public MqttClientConfig setBlockingTimeoutSeconds(int blockingTimeoutSeconds)
blockingTimeoutSeconds
- Seconds until a blocked method invocation times out and an MqttTimeoutException
is thrown. 0 will wait forever. Applies only to
synchronous clients. It is ignored by asynchronous clients.
Defaults to 0 (wait forever).
public int getKeepAliveSeconds()
If the broker does not receive a message from the client within one and a half times the Keep Alive time period (the client is allowed "grace" of half a time period), it disconnects the client. This action does not impact any of the client's subscriptions.
If this client does not receive a PINGRESP message within a Keep Alive time period after sending a PINGREQ, it closes the TCP/IP socket connection.
The Keep Alive timer is a 16-bit value that represents the number of seconds for the time period. The actual value is application-specific, but a typical value is a few minutes. The maximum value is approximately 18 hours. A value of zero (0) means the client is not disconnected.
Defaults to 300 seconds (5 minutes).
public MqttClientConfig setKeepAliveSeconds(int keepAliveSeconds)
keepAliveSeconds
- The Keep Alive timer, measured in seconds, defines the maximum time interval between messages received from a client. It enables the broker to
detect that the network connection to a client has dropped, without having to wait for the long TCP/IP timeout. In the absence of a
data-related message during the time period, this client sends a PINGREQ message, which the broker acknowledges with a PINGRESP message.
If the broker does not receive a message from the client within one and a half times the Keep Alive time period (the client is allowed "grace" of half a time period), it disconnects the client. This action does not impact any of the client's subscriptions.
If this client does not receive a PINGRESP message within a Keep Alive time period after sending a PINGREQ, it closes the TCP/IP socket connection.
The Keep Alive timer is a 16-bit value that represents the number of seconds for the time period. The actual value is application-specific, but a typical value is a few minutes. The maximum value is approximately 18 hours. A value of zero (0) means the client is not disconnected.
Defaults to 300 seconds (5 minutes).
public MqttClientConfig clone()
clone
in class Object
Object.clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |