Package software.amazon.awssdk.crt.mqtt
Class MqttClient
- java.lang.Object
-
- software.amazon.awssdk.crt.CrtResource
-
- software.amazon.awssdk.crt.mqtt.MqttClient
-
- All Implemented Interfaces:
AutoCloseable
public class MqttClient extends CrtResource
This class wraps aws-c-mqtt to provide the basic MQTT pub/sub functionalities via the AWS Common Runtime One MqttClient class is needed per application. It can create any number of connections to any number of MQTT endpoints
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class software.amazon.awssdk.crt.CrtResource
CrtResource.ResourceInstance
-
-
Constructor Summary
Constructors Constructor Description MqttClient(ClientBootstrap clientBootstrap)
Creates an MqttClient with no TLS from the providedClientBootstrap
MqttClient(ClientBootstrap clientBootstrap, TlsContext context)
Creates an MqttClient from the providedClientBootstrap
andTlsContext
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canReleaseReferencesImmediately()
Determines whether a resource releases its dependencies at the same time the native handle is released or if it waits.TlsContext
getTlsContext()
protected void
releaseNativeHandle()
Cleans up the native resources associated with this client.-
Methods inherited from class software.amazon.awssdk.crt.CrtResource
acquireNativeHandle, addRef, addReferenceTo, close, collectNativeResource, collectNativeResources, decRef, getNativeHandle, getResourceLogDescription, isNull, logNativeResources, releaseReferences, removeReferenceTo, setDescription, swapReferenceTo, waitForNoResources
-
-
-
-
Constructor Detail
-
MqttClient
public MqttClient(ClientBootstrap clientBootstrap) throws CrtRuntimeException
Creates an MqttClient with no TLS from the providedClientBootstrap
- Parameters:
clientBootstrap
- The ClientBootstrap to use- Throws:
CrtRuntimeException
- If the system is unable to allocate space for a native MQTT client structure
-
MqttClient
public MqttClient(ClientBootstrap clientBootstrap, TlsContext context) throws CrtRuntimeException
Creates an MqttClient from the providedClientBootstrap
andTlsContext
- Parameters:
clientBootstrap
- The ClientBootstrap to usecontext
- the tls context to use- Throws:
CrtRuntimeException
- If the system is unable to allocate space for a native MQTT client structure
-
-
Method Detail
-
getTlsContext
public TlsContext getTlsContext()
- Returns:
- the tls context used by all connections associated with this client.
-
releaseNativeHandle
protected void releaseNativeHandle()
Cleans up the native resources associated with this client. The client is unusable after this call- Specified by:
releaseNativeHandle
in classCrtResource
-
canReleaseReferencesImmediately
protected boolean canReleaseReferencesImmediately()
Determines whether a resource releases its dependencies at the same time the native handle is released or if it waits. Resources that wait are responsible for calling releaseReferences() manually.- Specified by:
canReleaseReferencesImmediately
in classCrtResource
- Returns:
- true if this resource releases synchronously, false if this resource performs async shutdown
-
-