public class MqttClientOptions extends NetClientOptions
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ACK_TIMEOUT |
static boolean |
DEFAULT_AUTO_ACK |
static boolean |
DEFAULT_CLEAN_SESSION |
static String |
DEFAULT_HOST |
static int |
DEFAULT_KEEP_ALIVE_INTERVAL |
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_INTERVAL, DEFAULT_REGISTER_WRITE_HANDLER
DEFAULT_CONNECT_TIMEOUT, DEFAULT_METRICS_NAME, DEFAULT_TRUST_ALL
DEFAULT_ENABLED_SECURE_TRANSPORT_PROTOCOLS, DEFAULT_IDLE_TIMEOUT, DEFAULT_IDLE_TIMEOUT_TIME_UNIT, DEFAULT_READ_IDLE_TIMEOUT, 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_KEEAPLIVE_INTERVAL_SECONDS, DEFAULT_TCP_KEEP_ALIVE, DEFAULT_TCP_KEEPALIVE_COUNT, DEFAULT_TCP_KEEPALIVE_IDLE_SECONDS, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_TCP_USER_TIMEOUT, DEFAULT_USE_ALPN, DEFAULT_WRITE_IDLE_TIMEOUT
DEFAULT_LOG_ACTIVITY_FORMAT, DEFAULT_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 |
getIdleTimeout() |
int |
getKeepAliveInterval() |
int |
getMaxInflightQueue() |
int |
getMaxMessageSize() |
String |
getPassword() |
String |
getUsername() |
String |
getWillMessage()
Deprecated.
|
Buffer |
getWillMessageBytes() |
int |
getWillQoS() |
String |
getWillTopic() |
boolean |
hasPassword() |
boolean |
hasUsername() |
boolean |
isAutoAck() |
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.
|
void |
setAutoAck(boolean autoAck)
Set to false to let the application code to ack the message via
MqttPublishMessage#ack() . |
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 |
setHostnameVerificationAlgorithm(String hostnameVerificationAlgorithm)
Set the hostname verification algorithm interval
To disable hostname verification, set hostnameVerificationAlgorithm to an empty String
|
MqttClientOptions |
setIdleTimeout(int idleTimeout)
Deprecated.
|
MqttClientOptions |
setKeepAliveInterval(int keepAliveInterval)
Set the keep alive interval in seconds
|
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)
Deprecated.
|
MqttClientOptions |
setWillMessageBytes(Buffer 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
|
JsonObject |
toJson()
Convert to JSON
|
String |
toString() |
addNonProxyHost, getApplicationLayerProtocols, getHostnameVerificationAlgorithm, getReconnectAttempts, getReconnectInterval, isRegisterWriteHandler, removeEnabledCipherSuite, removeEnabledSecureTransportProtocol, setActivityLogDataFormat, setApplicationLayerProtocols, setConnectTimeout, setEnabledSecureTransportProtocols, setIdleTimeoutUnit, setJdkSslEngineOptions, setLocalAddress, setLogActivity, setMetricsName, setNonProxyHosts, setOpenSslEngineOptions, setProxyOptions, setReadIdleTimeout, setReconnectAttempts, setReconnectInterval, setRegisterWriteHandler, setReuseAddress, setReusePort, setSendBufferSize, setSoLinger, setSslEngineOptions, setSslHandshakeTimeout, setSslHandshakeTimeoutUnit, setTcpCork, setTcpFastOpen, setTcpKeepAlive, setTcpNoDelay, setTcpQuickAck, setTrafficClass, setUseAlpn, setWriteIdleTimeout
getConnectTimeout, getLocalAddress, getMetricsName, getNonProxyHosts, getProxyOptions, isTrustAll, setTcpUserTimeout
getCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeoutUnit, getJdkSslEngineOptions, getKeyCertOptions, getKeyStoreOptions, getOpenSslEngineOptions, getPemKeyCertOptions, getPemTrustOptions, getPfxKeyCertOptions, getPfxTrustOptions, getReadIdleTimeout, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getSslOptions, getTcpKeepAliveCount, getTcpKeepAliveIdleSeconds, getTcpKeepAliveIntervalSeconds, getTcpUserTimeout, getTrustOptions, getTrustStoreOptions, getWriteIdleTimeout, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn, setTcpKeepAliveCount, setTcpKeepAliveIdleSeconds, setTcpKeepAliveIntervalSeconds
getActivityLogDataFormat, getLogActivity, getReceiveBufferSize, getSendBufferSize, getTrafficClass, isReuseAddress, isReusePort
public 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
public 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 static final boolean DEFAULT_AUTO_ACK
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()
public int getKeepAliveInterval()
public String getUsername()
public String getPassword()
public String getClientId()
public String getWillTopic()
@Deprecated public String getWillMessage()
public Buffer getWillMessageBytes()
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 published@Deprecated public MqttClientOptions setWillMessage(String willMessage)
willMessage
- content of the will messagepublic MqttClientOptions setWillMessageBytes(Buffer 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 retainedpublic 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 isAutoAck()
public void setAutoAck(boolean autoAck)
MqttPublishMessage#ack()
.
If true, the ack (PUBACK/PUBCOMP) will be sent by vertx-mqtt before MqttClient#publishHandler()
execution.
(default is true)autoAck
- public boolean isAutoKeepAlive()
public boolean isAutoGeneratedClientId()
public int getMaxMessageSize()
public MqttClientOptions setReceiveBufferSize(int receiveBufferSize)
NetworkOptions
setReceiveBufferSize
in class NetClientOptions
receiveBufferSize
- the buffers size, in bytespublic MqttClientOptions setMaxMessageSize(int maxMessageSize)
maxMessageSize
- max MQTT message size@Deprecated public MqttClientOptions setIdleTimeout(int idleTimeout)
setKeepAliveInterval(int)
(int)}. Use it instead.setIdleTimeout
in class NetClientOptions
idleTimeout
- the timeoutpublic int getIdleTimeout()
getIdleTimeout
in class TCPSSLOptions
TCPSSLOptions.getIdleTimeoutUnit()
.public MqttClientOptions setSsl(boolean ssl)
TCPSSLOptions
setSsl
in class NetClientOptions
ssl
- true if enabledpublic MqttClientOptions setTrustStoreOptions(JksOptions options)
TCPSSLOptions
setTrustStoreOptions
in class NetClientOptions
options
- the trust options in jks formatpublic MqttClientOptions setHostnameVerificationAlgorithm(String hostnameVerificationAlgorithm)
NetClientOptions
setHostnameVerificationAlgorithm
in class NetClientOptions
hostnameVerificationAlgorithm
- should be HTTPS, LDAPS or an empty Stringpublic MqttClientOptions setTrustAll(boolean trustAll)
ClientOptionsBase
setTrustAll
in class NetClientOptions
trustAll
- true if all should be trustedpublic MqttClientOptions setKeyCertOptions(KeyCertOptions options)
TCPSSLOptions
setKeyCertOptions
in class NetClientOptions
options
- the key store optionspublic MqttClientOptions setKeyStoreOptions(JksOptions options)
TCPSSLOptions
setKeyStoreOptions
in class NetClientOptions
options
- the key store in jks formatpublic MqttClientOptions setPfxKeyCertOptions(PfxOptions options)
TCPSSLOptions
setPfxKeyCertOptions
in class NetClientOptions
options
- the key cert options in pfx formatpublic MqttClientOptions setPemKeyCertOptions(PemKeyCertOptions options)
TCPSSLOptions
setPemKeyCertOptions
in class NetClientOptions
options
- the options in pem formatpublic MqttClientOptions setTrustOptions(TrustOptions options)
TCPSSLOptions
setTrustOptions
in class NetClientOptions
options
- the trust optionspublic MqttClientOptions setPemTrustOptions(PemTrustOptions options)
TCPSSLOptions
setPemTrustOptions
in class NetClientOptions
options
- the trust options in pem formatpublic MqttClientOptions setPfxTrustOptions(PfxOptions options)
TCPSSLOptions
setPfxTrustOptions
in class NetClientOptions
options
- the trust options in pfx formatpublic MqttClientOptions addEnabledCipherSuite(String suite)
TCPSSLOptions
addEnabledCipherSuite
in class NetClientOptions
suite
- the suiteTCPSSLOptions.getEnabledCipherSuites()
public MqttClientOptions addEnabledSecureTransportProtocol(String protocol)
TCPSSLOptions
addEnabledSecureTransportProtocol
in class NetClientOptions
protocol
- the SSL/TLS protocol to enablepublic MqttClientOptions addCrlPath(String crlPath) throws NullPointerException
TCPSSLOptions
addCrlPath
in class NetClientOptions
crlPath
- the pathNullPointerException
public MqttClientOptions addCrlValue(Buffer crlValue) throws NullPointerException
TCPSSLOptions
addCrlValue
in class NetClientOptions
crlValue
- the valueNullPointerException
public JsonObject toJson()
ClientOptionsBase
toJson
in class NetClientOptions
Copyright © 2024 Eclipse. All rights reserved.