public class MqttClientOptions extends NetClientOptions
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_ACK_TIMEOUT |
static boolean |
DEFAULT_CLEAN_SESSION |
static String |
DEFAULT_HOST |
static int |
DEFAULT_KEEP_ALIVE_INTERVAL |
static int |
DEFAULT_KEEP_ALIVE_TIME_SECONDS
Deprecated.
|
static int |
DEFAULT_MAX_INFLIGHT_QUEUE |
static int |
DEFAULT_MAX_MESSAGE_SIZE |
static int |
DEFAULT_PORT |
static int |
DEFAULT_TSL_PORT |
static boolean |
DEFAULT_WILL_FLAG |
static int |
DEFAULT_WILL_QOS |
static boolean |
DEFAULT_WILL_RETAIN |
DEFAULT_HOSTNAME_VERIFICATION_ALGORITHM, DEFAULT_RECONNECT_ATTEMPTS, DEFAULT_RECONNECT_INTERVALDEFAULT_CONNECT_TIMEOUT, DEFAULT_METRICS_NAME, DEFAULT_TRUST_ALLDEFAULT_ENABLED_SECURE_TRANSPORT_PROTOCOLS, DEFAULT_IDLE_TIMEOUT, DEFAULT_IDLE_TIMEOUT_TIME_UNIT, DEFAULT_SO_LINGER, DEFAULT_SSL, DEFAULT_SSL_ENGINE, DEFAULT_SSL_HANDSHAKE_TIMEOUT, DEFAULT_SSL_HANDSHAKE_TIMEOUT_TIME_UNIT, DEFAULT_TCP_CORK, DEFAULT_TCP_FAST_OPEN, DEFAULT_TCP_KEEP_ALIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_TCP_USER_TIMEOUT, DEFAULT_USE_ALPN, DEFAULT_USE_POOLED_BUFFERSDEFAULT_LOG_ENABLED, DEFAULT_RECEIVE_BUFFER_SIZE, DEFAULT_REUSE_ADDRESS, DEFAULT_REUSE_PORT, DEFAULT_SEND_BUFFER_SIZE, DEFAULT_TRAFFIC_CLASS| Constructor and Description |
|---|
MqttClientOptions()
Default constructor
|
MqttClientOptions(JsonObject json)
Create an instance of MqttClientOptions from JSON
|
MqttClientOptions(MqttClientOptions other)
Copy constructor
|
| Modifier and Type | Method and Description |
|---|---|
MqttClientOptions |
addCrlPath(String crlPath)
Add a CRL path
|
MqttClientOptions |
addCrlValue(Buffer crlValue)
Add a CRL value
|
MqttClientOptions |
addEnabledCipherSuite(String suite)
Add an enabled cipher suite, appended to the ordered suites.
|
MqttClientOptions |
addEnabledSecureTransportProtocol(String protocol)
Add an enabled SSL/TLS protocols, appended to the ordered protocols.
|
int |
getAckTimeout()
Gets the time in seconds after which the client stops waiting for a PUBACK, PUBREC
or PUBCOMP packet from the server in response to a packet it has sent.
|
String |
getClientId() |
int |
getKeepAliveInterval() |
int |
getKeepAliveTimeSeconds()
Deprecated.
instead use
getKeepAliveInterval() |
int |
getMaxInflightQueue() |
int |
getMaxMessageSize() |
String |
getPassword() |
String |
getUsername() |
String |
getWillMessage() |
int |
getWillQoS() |
String |
getWillTopic() |
boolean |
hasPassword() |
boolean |
hasUsername() |
boolean |
isAutoGeneratedClientId() |
boolean |
isAutoKeepAlive() |
boolean |
isCleanSession() |
boolean |
isWillFlag() |
boolean |
isWillRetain() |
MqttClientOptions |
setAckTimeout(int ackTimeoutSeconds)
Sets the time in seconds after which the client will stop waiting for a PUBACK, PUBREC
or PUBCOMP packet from the server in response to a packet it has sent.
|
MqttClientOptions |
setAutoGeneratedClientId(boolean isAutoGeneratedClientId)
Set if the MQTT client must generate clientId automatically
(default is true)
|
MqttClientOptions |
setAutoKeepAlive(boolean isAutoKeepAlive)
Set if the MQTT client must handle PINGREQ automatically
(default is true)
|
MqttClientOptions |
setCleanSession(boolean cleanSession)
Set to start with a clean session (or not)
|
MqttClientOptions |
setClientId(String clientId)
Set the client identifier
|
MqttClientOptions |
setIdleTimeout(int idleTimeout)
Deprecated.
|
MqttClientOptions |
setKeepAliveInterval(int keepAliveInterval)
Set the keep alive interval in seconds
|
MqttClientOptions |
setKeepAliveTimeSeconds(int keepAliveInterval)
Deprecated.
instead use
setKeepAliveInterval(int) |
MqttClientOptions |
setKeyCertOptions(KeyCertOptions options)
Set the key/cert options.
|
MqttClientOptions |
setKeyStoreOptions(JksOptions options)
Set the key/cert options in jks format, aka Java keystore.
|
MqttClientOptions |
setMaxInflightQueue(int maxInflightQueue)
Set max count of unacknowledged messages
|
MqttClientOptions |
setMaxMessageSize(int maxMessageSize)
Set max MQTT message size
|
MqttClientOptions |
setPassword(String password)
Set the password
|
MqttClientOptions |
setPemKeyCertOptions(PemKeyCertOptions options)
Set the key/cert store options in pem format.
|
MqttClientOptions |
setPemTrustOptions(PemTrustOptions options)
Set the trust options in pem format
|
MqttClientOptions |
setPfxKeyCertOptions(PfxOptions options)
Set the key/cert options in pfx format.
|
MqttClientOptions |
setPfxTrustOptions(PfxOptions options)
Set the trust options in pfx format
|
MqttClientOptions |
setReceiveBufferSize(int receiveBufferSize)
Set the TCP receive buffer size
|
MqttClientOptions |
setSsl(boolean ssl)
Set whether SSL/TLS is enabled
|
MqttClientOptions |
setTrustAll(boolean trustAll)
Set whether all server certificates should be trusted
|
MqttClientOptions |
setTrustOptions(TrustOptions options)
Set the trust options.
|
MqttClientOptions |
setTrustStoreOptions(JksOptions options)
Set the trust options in jks format, aka Java truststore
|
MqttClientOptions |
setUsername(String username)
Set the username
|
MqttClientOptions |
setWillFlag(boolean willFlag)
Set if will information are provided on connection
|
MqttClientOptions |
setWillMessage(String willMessage)
Set the content of the will message
|
MqttClientOptions |
setWillQoS(int willQoS)
Set the QoS level for the will message
|
MqttClientOptions |
setWillRetain(boolean willRetain)
Set if the will message must be retained
|
MqttClientOptions |
setWillTopic(String willTopic)
Set the topic on which the will message will be published
|
String |
toString() |
equals, getHostnameVerificationAlgorithm, getReconnectAttempts, getReconnectInterval, hashCode, removeEnabledSecureTransportProtocol, setConnectTimeout, setEnabledSecureTransportProtocols, setHostnameVerificationAlgorithm, setIdleTimeoutUnit, setJdkSslEngineOptions, setLocalAddress, setLogActivity, setMetricsName, setOpenSslEngineOptions, setProxyOptions, setReconnectAttempts, setReconnectInterval, setReuseAddress, setReusePort, setSendBufferSize, setSoLinger, setSslEngineOptions, setSslHandshakeTimeout, setSslHandshakeTimeoutUnit, setTcpCork, setTcpFastOpen, setTcpKeepAlive, setTcpNoDelay, setTcpQuickAck, setTrafficClass, setUseAlpn, setUsePooledBuffersgetConnectTimeout, getLocalAddress, getMetricsName, getProxyOptions, isTrustAll, setTcpUserTimeout, toJsongetCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeout, getIdleTimeoutUnit, getJdkSslEngineOptions, getKeyCertOptions, getKeyStoreOptions, getOpenSslEngineOptions, getPemKeyCertOptions, getPemTrustOptions, getPfxKeyCertOptions, getPfxTrustOptions, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getTcpUserTimeout, getTrustOptions, getTrustStoreOptions, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn, isUsePooledBuffersgetLogActivity, getReceiveBufferSize, getSendBufferSize, getTrafficClass, isReuseAddress, isReusePortpublic static final int DEFAULT_PORT
public static final int DEFAULT_TSL_PORT
public static final String DEFAULT_HOST
public static final int DEFAULT_WILL_QOS
public static final int DEFAULT_KEEP_ALIVE_INTERVAL
@Deprecated public static final int DEFAULT_KEEP_ALIVE_TIME_SECONDS
DEFAULT_KEEP_ALIVE_INTERVALpublic static final int DEFAULT_MAX_INFLIGHT_QUEUE
public static final boolean DEFAULT_CLEAN_SESSION
public static final boolean DEFAULT_WILL_FLAG
public static final boolean DEFAULT_WILL_RETAIN
public static final int DEFAULT_MAX_MESSAGE_SIZE
public static final int DEFAULT_ACK_TIMEOUT
public MqttClientOptions()
public MqttClientOptions(JsonObject json)
json - the JSONpublic MqttClientOptions(MqttClientOptions other)
other - the options to copypublic boolean hasUsername()
public boolean hasPassword()
public boolean isCleanSession()
public boolean isWillFlag()
public boolean isWillRetain()
public int getWillQoS()
@Deprecated public int getKeepAliveTimeSeconds()
getKeepAliveInterval()public int getKeepAliveInterval()
public String getUsername()
public String getPassword()
public String getClientId()
public String getWillTopic()
public String getWillMessage()
public MqttClientOptions setClientId(String clientId)
clientId - client identifierpublic MqttClientOptions setUsername(String username)
username - usernamepublic MqttClientOptions setPassword(String password)
password - passwordpublic MqttClientOptions setWillTopic(String willTopic)
willTopic - topic on which the will message will be publishedpublic MqttClientOptions setWillMessage(String willMessage)
willMessage - content of the will messagepublic MqttClientOptions setCleanSession(boolean cleanSession)
cleanSession - if clean session should be activatedpublic MqttClientOptions setWillFlag(boolean willFlag)
willFlag - if will information are provided on connectionpublic MqttClientOptions setWillQoS(int willQoS)
willQoS - QoS level for the will messagepublic MqttClientOptions setWillRetain(boolean willRetain)
willRetain - if thw will message must be retained@Deprecated public MqttClientOptions setKeepAliveTimeSeconds(int keepAliveInterval)
setKeepAliveInterval(int)public MqttClientOptions setKeepAliveInterval(int keepAliveInterval)
keepAliveInterval - keep alive interval in secondspublic int getAckTimeout()
The default value of this property is 10s.
public MqttClientOptions setAckTimeout(int ackTimeoutSeconds)
The default value of this property is -1 which indicates that the client should wait an unlimited time for the server's acknowledgement.
ackTimeoutSeconds - timeout in secondsIllegalArgumentException - if the timeout is 0 or < -1.public int getMaxInflightQueue()
public MqttClientOptions setMaxInflightQueue(int maxInflightQueue)
maxInflightQueue - max count of unacknowledged messagespublic MqttClientOptions setAutoKeepAlive(boolean isAutoKeepAlive)
isAutoKeepAlive - ping request handled automaticallypublic MqttClientOptions setAutoGeneratedClientId(boolean isAutoGeneratedClientId)
isAutoGeneratedClientId - clientId generated automaticallypublic boolean isAutoKeepAlive()
public boolean isAutoGeneratedClientId()
public int getMaxMessageSize()
public MqttClientOptions setReceiveBufferSize(int receiveBufferSize)
NetworkOptionssetReceiveBufferSize in class NetClientOptionsreceiveBufferSize - the buffers size, in bytespublic MqttClientOptions setMaxMessageSize(int maxMessageSize)
maxMessageSize - max MQTT message size@Deprecated public MqttClientOptions setIdleTimeout(int idleTimeout)
setKeepAliveTimeSeconds(int). Use it instead.setIdleTimeout in class NetClientOptionsidleTimeout - the timeout, in secondspublic MqttClientOptions setSsl(boolean ssl)
TCPSSLOptionssetSsl in class NetClientOptionsssl - true if enabledpublic MqttClientOptions setTrustStoreOptions(JksOptions options)
TCPSSLOptionssetTrustStoreOptions in class NetClientOptionsoptions - the trust options in jks formatpublic MqttClientOptions setTrustAll(boolean trustAll)
ClientOptionsBasesetTrustAll in class NetClientOptionstrustAll - true if all should be trustedpublic MqttClientOptions setKeyCertOptions(KeyCertOptions options)
TCPSSLOptionssetKeyCertOptions in class NetClientOptionsoptions - the key store optionspublic MqttClientOptions setKeyStoreOptions(JksOptions options)
TCPSSLOptionssetKeyStoreOptions in class NetClientOptionsoptions - the key store in jks formatpublic MqttClientOptions setPfxKeyCertOptions(PfxOptions options)
TCPSSLOptionssetPfxKeyCertOptions in class NetClientOptionsoptions - the key cert options in pfx formatpublic MqttClientOptions setPemKeyCertOptions(PemKeyCertOptions options)
TCPSSLOptionssetPemKeyCertOptions in class NetClientOptionsoptions - the options in pem formatpublic MqttClientOptions setTrustOptions(TrustOptions options)
TCPSSLOptionssetTrustOptions in class NetClientOptionsoptions - the trust optionspublic MqttClientOptions setPemTrustOptions(PemTrustOptions options)
TCPSSLOptionssetPemTrustOptions in class NetClientOptionsoptions - the trust options in pem formatpublic MqttClientOptions setPfxTrustOptions(PfxOptions options)
TCPSSLOptionssetPfxTrustOptions in class NetClientOptionsoptions - the trust options in pfx formatpublic MqttClientOptions addEnabledCipherSuite(String suite)
TCPSSLOptionsaddEnabledCipherSuite in class NetClientOptionssuite - the suitepublic MqttClientOptions addEnabledSecureTransportProtocol(String protocol)
TCPSSLOptionsaddEnabledSecureTransportProtocol in class NetClientOptionsprotocol - the SSL/TLS protocol to enablepublic MqttClientOptions addCrlPath(String crlPath) throws NullPointerException
TCPSSLOptionsaddCrlPath in class NetClientOptionscrlPath - the pathNullPointerExceptionpublic MqttClientOptions addCrlValue(Buffer crlValue) throws NullPointerException
TCPSSLOptionsaddCrlValue in class NetClientOptionscrlValue - the valueNullPointerExceptionCopyright © 2023 Eclipse. All rights reserved.