Package software.amazon.awssdk.crt.mqtt5
Class Mqtt5ClientOptions
- java.lang.Object
-
- software.amazon.awssdk.crt.mqtt5.Mqtt5ClientOptions
-
public class Mqtt5ClientOptions extends Object
Configuration for the creation of Mqtt5Clients
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Mqtt5ClientOptions.ClientOfflineQueueBehavior
Controls how disconnects affect the queued and in-progress operations tracked by the client.static class
Mqtt5ClientOptions.ClientSessionBehavior
Controls how the Mqtt5Client should behave with respect to MQTT sessions.static class
Mqtt5ClientOptions.ExtendedValidationAndFlowControlOptions
Additional controls for client behavior with respect to operation validation and flow control; these checks go beyond the MQTT5 spec to respect limits of specific MQTT brokers.static interface
Mqtt5ClientOptions.LifecycleEvents
An interface that defines all of the functions the Mqtt5Client will call when it receives a lifecycle event.static class
Mqtt5ClientOptions.Mqtt5ClientOptionsBuilder
All of the options for a Mqtt5Client.static interface
Mqtt5ClientOptions.PublishEvents
An interface that defines all of the publish functions the Mqtt5Client will call when it receives a publish packet.
-
Constructor Summary
Constructors Constructor Description Mqtt5ClientOptions(Mqtt5ClientOptions.Mqtt5ClientOptionsBuilder builder)
Creates a Mqtt5ClientOptionsBuilder instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Long
getAckTimeoutSeconds()
Returns the time interval to wait for an ack after sending a QoS 1+ PUBLISH, SUBSCRIBE, or UNSUBSCRIBE before failing the operation.ClientBootstrap
getBootstrap()
Returns the Client bootstrap used.Long
getConnackTimeoutMs()
Returns the time interval to wait after sending a CONNECT request for a CONNACK to arrive.ConnectPacket
getConnectOptions()
Returns all configurable options with respect to the CONNECT packet sent by the client, including the will.Mqtt5ClientOptions.ExtendedValidationAndFlowControlOptions
getExtendedValidationAndFlowControlOptions()
Returns the additional controls for client behavior with respect to operation validation and flow control; these checks go beyond the base MQTT5 spec to respect limits of specific MQTT brokers.String
getHostName()
Returns the host name of the MQTT server to connect to.HttpProxyOptions
getHttpProxyOptions()
Returns the (tunneling) HTTP proxy usage when establishing MQTT connectionsMqtt5ClientOptions.LifecycleEvents
getLifecycleEvents()
Returns the LifecycleEvents interface that will be called when the client gets a LifecycleEvent.Long
getMaxReconnectDelayMs()
Returns the maximum amount of time to wait to reconnect after a disconnect.Long
getMinConnectedTimeToResetReconnectDelayMs()
Returns the amount of time that must elapse with an established connection before the reconnect delay is reset to the minimum.Long
getMinReconnectDelayMs()
Returns the minimum amount of time to wait to reconnect after a disconnect.Mqtt5ClientOptions.ClientOfflineQueueBehavior
getOfflineQueueBehavior()
Returns how disconnects affect the queued and in-progress operations tracked by the client.Long
getPingTimeoutMs()
Returns the time interval to wait after sending a PINGREQ for a PINGRESP to arrive.Long
getPort()
Returns the network port of the MQTT server to connect to.Mqtt5ClientOptions.PublishEvents
getPublishEvents()
Returns the PublishEvents interface that will be called when the client gets a message.ExponentialBackoffRetryOptions.JitterMode
getRetryJitterMode()
Returns how the reconnect delay is modified in order to smooth out the distribution of reconnection attempt time points for a large set of reconnecting clients.Mqtt5ClientOptions.ClientSessionBehavior
getSessionBehavior()
Returns how the Mqtt5Client should behave with respect to MQTT sessions.SocketOptions
getSocketOptions()
Returns the socket properties of the underlying MQTT connections made by the client.TlsContext
getTlsContext()
Returns the TLS context for secure socket connections.TopicAliasingOptions
getTopicAliasingOptions()
Returns the topic aliasing options to be used by the clientConsumer<Mqtt5WebsocketHandshakeTransformArgs>
getWebsocketHandshakeTransform()
Returns the callback that allows a custom transformation of the HTTP request which acts as the websocket handshake.
-
-
-
Constructor Detail
-
Mqtt5ClientOptions
public Mqtt5ClientOptions(Mqtt5ClientOptions.Mqtt5ClientOptionsBuilder builder)
Creates a Mqtt5ClientOptionsBuilder instance- Parameters:
builder
- The builder to get the Mqtt5ClientOptions values from
-
-
Method Detail
-
getHostName
public String getHostName()
Returns the host name of the MQTT server to connect to.- Returns:
- Host name of the MQTT server to connect to.
-
getPort
public Long getPort()
Returns the network port of the MQTT server to connect to.- Returns:
- Network port of the MQTT server to connect to.
-
getBootstrap
public ClientBootstrap getBootstrap()
Returns the Client bootstrap used.- Returns:
- The Client bootstrap used
-
getSocketOptions
public SocketOptions getSocketOptions()
Returns the socket properties of the underlying MQTT connections made by the client.- Returns:
- the socket properties of the underlying MQTT connections made by the client or null if defaults are used.
-
getTlsContext
public TlsContext getTlsContext()
Returns the TLS context for secure socket connections. If null, then a plaintext connection will be used.- Returns:
- TLS context for secure socket connections.
-
getHttpProxyOptions
public HttpProxyOptions getHttpProxyOptions()
Returns the (tunneling) HTTP proxy usage when establishing MQTT connections- Returns:
- (tunneling) HTTP proxy usage when establishing MQTT connections
-
getConnectOptions
public ConnectPacket getConnectOptions()
Returns all configurable options with respect to the CONNECT packet sent by the client, including the will. These connect properties will be used for every connection attempt made by the client.- Returns:
- all configurable options with respect to the CONNECT packet sent by the client, including the will
-
getSessionBehavior
public Mqtt5ClientOptions.ClientSessionBehavior getSessionBehavior()
Returns how the Mqtt5Client should behave with respect to MQTT sessions.- Returns:
- How the Mqtt5Client should behave with respect to MQTT sessions.
-
getExtendedValidationAndFlowControlOptions
public Mqtt5ClientOptions.ExtendedValidationAndFlowControlOptions getExtendedValidationAndFlowControlOptions()
Returns the additional controls for client behavior with respect to operation validation and flow control; these checks go beyond the base MQTT5 spec to respect limits of specific MQTT brokers.- Returns:
- The additional controls for client behavior with respect to operation validation and flow control
-
getOfflineQueueBehavior
public Mqtt5ClientOptions.ClientOfflineQueueBehavior getOfflineQueueBehavior()
Returns how disconnects affect the queued and in-progress operations tracked by the client. Also controls how new operations are handled while the client is not connected. In particular, if the client is not connected, then any operation that would be failed on disconnect (according to these rules) will also be rejected.- Returns:
- How disconnects affect the queued and in-progress operations tracked by the client.
-
getRetryJitterMode
public ExponentialBackoffRetryOptions.JitterMode getRetryJitterMode()
Returns how the reconnect delay is modified in order to smooth out the distribution of reconnection attempt time points for a large set of reconnecting clients.- Returns:
- how the reconnect delay is modified in order to smooth out the distribution of reconnection attempt time points for a large set of reconnecting clients.
-
getMinReconnectDelayMs
public Long getMinReconnectDelayMs()
Returns the minimum amount of time to wait to reconnect after a disconnect. Exponential back-off is performed with jitter after each connection failure.- Returns:
- The minimum amount of time to wait to reconnect after a disconnect.
-
getMaxReconnectDelayMs
public Long getMaxReconnectDelayMs()
Returns the maximum amount of time to wait to reconnect after a disconnect. Exponential back-off is performed with jitter after each connection failure.- Returns:
- The maximum amount of time to wait to reconnect after a disconnect
-
getMinConnectedTimeToResetReconnectDelayMs
public Long getMinConnectedTimeToResetReconnectDelayMs()
Returns the amount of time that must elapse with an established connection before the reconnect delay is reset to the minimum. This helps alleviate bandwidth-waste in fast reconnect cycles due to permission failures on operations.- Returns:
- The amount of time that must elapse with an established connection before the reconnect delay is reset to the minimum
-
getPingTimeoutMs
public Long getPingTimeoutMs()
Returns the time interval to wait after sending a PINGREQ for a PINGRESP to arrive. If one does not arrive, the client will close the current connection.- Returns:
- time interval to wait after sending a PINGREQ for a PINGRESP to arrive.
-
getConnackTimeoutMs
public Long getConnackTimeoutMs()
Returns the time interval to wait after sending a CONNECT request for a CONNACK to arrive. If one does not arrive, the connection will be shut down.- Returns:
- Time interval to wait after sending a CONNECT request for a CONNACK to arrive
-
getAckTimeoutSeconds
public Long getAckTimeoutSeconds()
Returns the time interval to wait for an ack after sending a QoS 1+ PUBLISH, SUBSCRIBE, or UNSUBSCRIBE before failing the operation.- Returns:
- the time interval to wait for an ack after sending a QoS 1+ PUBLISH, SUBSCRIBE, or UNSUBSCRIBE before failing the operation.
-
getLifecycleEvents
public Mqtt5ClientOptions.LifecycleEvents getLifecycleEvents()
Returns the LifecycleEvents interface that will be called when the client gets a LifecycleEvent.- Returns:
- The LifecycleEvents interface that will be called when the client gets a LifecycleEvent
-
getWebsocketHandshakeTransform
public Consumer<Mqtt5WebsocketHandshakeTransformArgs> getWebsocketHandshakeTransform()
Returns the callback that allows a custom transformation of the HTTP request which acts as the websocket handshake. Websockets will be used if this is set to a valid transformation callback. To use websockets but not perform a transformation, just set this as a trivial completion callback. If null, the connection will be made with direct MQTT.- Returns:
- The custom transformation of the HTTP request that acts as the websocket handshake or null.
-
getPublishEvents
public Mqtt5ClientOptions.PublishEvents getPublishEvents()
Returns the PublishEvents interface that will be called when the client gets a message.- Returns:
- PublishEvents interface that will be called when the client gets a message.
-
getTopicAliasingOptions
public TopicAliasingOptions getTopicAliasingOptions()
Returns the topic aliasing options to be used by the client- Returns:
- the topic aliasing options to be used by the client
-
-