public final class MqttConnectionConfig extends CrtResource
CrtResource.ResourceInstance
Constructor and Description |
---|
MqttConnectionConfig() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canReleaseReferencesImmediately()
Override that determines whether a resource releases its dependencies at the same time the native handle is released or if it waits.
|
MqttConnectionConfig |
clone()
Creates a (shallow) clone of this config object
|
boolean |
getCleanSession()
Queries whether or not the service should try to resume prior subscriptions, if it has any
|
String |
getClientId()
Queries the client_id being used by a connection
|
MqttClientConnectionEvents |
getConnectionCallbacks()
Queries the connection-related callbacks for a connection
|
String |
getEndpoint()
Queries the IoT endpoint used by a connection
|
HttpProxyOptions |
getHttpProxyOptions()
Queries proxy options for an mqtt connection
|
int |
getKeepAliveMs()
Deprecated.
Queries the MQTT keep-alive via PING messages. Please use
getKeepAliveSecs instead.
|
int |
getKeepAliveSecs()
Queries the MQTT keep-alive via PING messages.
|
long |
getMaxReconnectTimeoutSecs()
Return the maximum reconnect timeout.
|
long |
getMinReconnectTimeoutSecs()
Return the minimum reconnect timeout.
|
MqttClient |
getMqttClient()
Queries the mqtt client to use for a connection
|
String |
getPassword()
Queries the password to use as part of the CONNECT attempt
|
int |
getPingTimeoutMs()
Queries ping timeout value.
|
int |
getPort()
Queries the port to connect to.
|
int |
getProtocolOperationTimeoutMs()
Queries timeout value for requests that response is required on healthy connection.
|
SocketOptions |
getSocketOptions()
Queries the common settings to use for a connection's socket
|
String |
getUsername()
Queries the username to use as part of the CONNECT attempt
|
boolean |
getUseWebsockets()
Queries whether or not to use websockets for the mqtt connection
|
java.util.function.Consumer<WebsocketHandshakeTransformArgs> |
getWebsocketHandshakeTransform()
Queries the handshake http request transform to use when upgrading the connection
|
HttpProxyOptions |
getWebsocketProxyOptions()
Deprecated.
use getHttpProxyOptions instead
Queries proxy options for a websocket-based mqtt connection
|
MqttMessage |
getWillMessage()
Queries the last will and testament message to be delivered to a topic when a connection disconnects
|
QualityOfService |
getWillQos()
Deprecated.
Query QoS directly from the will's
MqttMessage . |
boolean |
getWillRetain()
Deprecated.
Query retain directly from the will's
MqttMessage . |
protected void |
releaseNativeHandle()
Required override method that must begin the release process of the acquired native handle
|
void |
setCleanSession(boolean cleanSession)
Configures whether or not the service should try to resume prior subscriptions, if it has any
|
void |
setClientId(String clientId)
Configures the client_id to use with a connection
|
void |
setConnectionCallbacks(MqttClientConnectionEvents connectionCallbacks)
Configures the connection-related callbacks for a connection
|
void |
setEndpoint(String endpoint)
Configures the IoT endpoint for a connection
|
void |
setHttpProxyOptions(HttpProxyOptions proxyOptions)
Configures proxy options for the mqtt connection
|
void |
setKeepAliveMs(int keepAliveMs)
Deprecated.
Configures MQTT keep-alive via PING messages. Note that this is not TCP
keepalive. Please use setKeepAliveSecs instead.
|
void |
setKeepAliveSecs(int keepAliveSecs)
Configures MQTT keep-alive via PING messages.
|
void |
setLogin(String user,
String pass)
Sets the login credentials for a connection.
|
void |
setMqttClient(MqttClient mqttClient)
Configures the mqtt client to use for a connection
|
void |
setPassword(String password)
Configures the password to use as part of the CONNECT attempt
|
void |
setPingTimeoutMs(int pingTimeoutMs)
Configures ping timeout value.
|
void |
setPort(int port)
Configures the port to connect to.
|
void |
setProtocolOperationTimeoutMs(int protocolOperationTimeoutMs)
Configures timeout value for requests that response is required on healthy connection.
|
void |
setReconnectTimeoutSecs(long minTimeoutSecs,
long maxTimeoutSecs)
Configures the minimum and maximum reconnect timeouts.
|
void |
setSocketOptions(SocketOptions socketOptions)
Configures the common settings to use for a connection's socket
|
void |
setUsername(String username)
Configures the username to use as part of the CONNECT attempt
|
void |
setUseWebsockets(boolean useWebsockets)
Configures whether or not to use websockets for the mqtt connection
|
void |
setWebsocketHandshakeTransform(java.util.function.Consumer<WebsocketHandshakeTransformArgs> handshakeTransform)
Set a transform operation to use on each websocket handshake http request.
|
void |
setWebsocketProxyOptions(HttpProxyOptions proxyOptions)
Deprecated.
use setHttpProxyOptions instead
Configures proxy options for a websocket-based mqtt connection
|
void |
setWillMessage(MqttMessage willMessage)
Configures the last will and testament message to be delivered to a topic when a connection disconnects
|
void |
setWillQos(QualityOfService qos)
Deprecated.
Set QoS directly on the will's
MqttMessage . |
void |
setWillRetain(boolean retain)
Deprecated.
Set retain directly on the will's
MqttMessage . |
acquireNativeHandle, addRef, addReferenceTo, close, collectNativeResource, collectNativeResources, decRef, getNativeHandle, getResourceLogDescription, isNull, logNativeResources, releaseReferences, removeReferenceTo, setDescription, swapReferenceTo, waitForNoResources
protected void releaseNativeHandle()
releaseNativeHandle
in class CrtResource
protected boolean canReleaseReferencesImmediately()
canReleaseReferencesImmediately
in class CrtResource
public void setConnectionCallbacks(MqttClientConnectionEvents connectionCallbacks)
connectionCallbacks
- connection event callbacks to usepublic MqttClientConnectionEvents getConnectionCallbacks()
public void setClientId(String clientId)
clientId
- The client id for a connection. Needs to be unique across
all devices/clients.this.credentialsProviderpublic String getClientId()
public void setEndpoint(String endpoint)
endpoint
- The IoT endpoint to connect topublic String getEndpoint()
public void setPort(int port)
port
- The port to connect to. Usually 8883 for MQTT, or 443 for websocketspublic int getPort()
public void setSocketOptions(SocketOptions socketOptions)
socketOptions
- The socket settingspublic SocketOptions getSocketOptions()
public void setCleanSession(boolean cleanSession)
cleanSession
- true if the session should drop prior subscriptions when
a connection is established, false to resume the sessionpublic boolean getCleanSession()
@Deprecated public void setKeepAliveMs(int keepAliveMs)
keepAliveMs
- How often in milliseconds to send an MQTT PING message to the
service to keep a connection alive@Deprecated public int getKeepAliveMs()
public void setKeepAliveSecs(int keepAliveSecs)
keepAliveSecs
- How often in seconds to send an MQTT PING message to the
service to keep a connection alivepublic int getKeepAliveSecs()
public void setPingTimeoutMs(int pingTimeoutMs)
pingTimeoutMs
- How long to wait for a ping response (in milliseconds) before resetting the connectionpublic int getPingTimeoutMs()
public void setReconnectTimeoutSecs(long minTimeoutSecs, long maxTimeoutSecs)
minTimeoutSecs
- The timeout to start withmaxTimeoutSecs
- The highest allowable wait time between reconnect attemptspublic long getMinReconnectTimeoutSecs()
public long getMaxReconnectTimeoutSecs()
public void setProtocolOperationTimeoutMs(int protocolOperationTimeoutMs)
protocolOperationTimeoutMs
- How long to wait for a request response (in milliseconds) before failingpublic int getProtocolOperationTimeoutMs()
public void setMqttClient(MqttClient mqttClient)
mqttClient
- the mqtt client to usepublic MqttClient getMqttClient()
public void setLogin(String user, String pass) throws MqttException
user
- Login usernamepass
- Login passwordMqttException
public void setUsername(String username)
username
- username to use for the mqtt connect operationpublic String getUsername()
public void setPassword(String password)
password
- password to use for the mqtt connect operationpublic String getPassword()
public void setWillMessage(MqttMessage willMessage)
willMessage
- the message to publish as the willpublic MqttMessage getWillMessage()
@Deprecated public void setWillQos(QualityOfService qos)
MqttMessage
.@Deprecated public QualityOfService getWillQos()
MqttMessage
.@Deprecated public void setWillRetain(boolean retain)
MqttMessage
.@Deprecated public boolean getWillRetain()
MqttMessage
.public void setUseWebsockets(boolean useWebsockets)
useWebsockets
- whether or not to use websocketspublic boolean getUseWebsockets()
public void setWebsocketProxyOptions(HttpProxyOptions proxyOptions)
proxyOptions
- proxy options to use for the base http connectionpublic HttpProxyOptions getWebsocketProxyOptions()
public void setHttpProxyOptions(HttpProxyOptions proxyOptions)
proxyOptions
- proxy options to use for the connectionpublic HttpProxyOptions getHttpProxyOptions()
public void setWebsocketHandshakeTransform(java.util.function.Consumer<WebsocketHandshakeTransformArgs> handshakeTransform)
handshakeTransform
- http request handshake transformpublic java.util.function.Consumer<WebsocketHandshakeTransformArgs> getWebsocketHandshakeTransform()
public MqttConnectionConfig clone()
Copyright © 2021. All rights reserved.