Class AWSIotDataAsyncClient

All Implemented Interfaces:
AWSIotData, AWSIotDataAsync

@ThreadSafe public class AWSIotDataAsyncClient extends AWSIotDataClient implements AWSIotDataAsync
Interface for accessing AWS IoT Data Plane asynchronously. Each asynchronous method will return a Java Future object representing the asynchronous operation; overloads which accept an AsyncHandler can be used to receive notification when an asynchronous operation completes.

AWS IoT

AWS IoT-Data enables secure, bi-directional communication between Internet-connected things (such as sensors, actuators, embedded devices, or smart appliances) and the AWS cloud. It implements a broker for applications and things to publish messages over HTTP (Publish) and retrieve, update, and delete thing shadows. A thing shadow is a persistent representation of your things and their state in the AWS cloud.

  • Constructor Details

    • AWSIotDataAsyncClient

      public AWSIotDataAsyncClient()
      Constructs a new asynchronous client to invoke service methods on AWS IoT Data Plane. A credentials provider chain will be used that searches for credentials in this order:
      • Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
      • Java System Properties - aws.accessKeyId and aws.secretKey
      • Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
      • Instance profile credentials delivered through the Amazon EC2 metadata service

      Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default maximum number of concurrent connections to the service).

      See Also:
    • AWSIotDataAsyncClient

      public AWSIotDataAsyncClient(ClientConfiguration clientConfiguration)
      Constructs a new asynchronous client to invoke service methods on AWS IoT Data Plane. A credentials provider chain will be used that searches for credentials in this order:
      • Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
      • Java System Properties - aws.accessKeyId and aws.secretKey
      • Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
      • Instance profile credentials delivered through the Amazon EC2 metadata service

      Asynchronous methods are delegated to a fixed-size thread pool containing a number of threads equal to the maximum number of concurrent connections configured via ClientConfiguration.getMaxConnections().

      Parameters:
      clientConfiguration - The client configuration options controlling how this client connects to AWS IoT Data Plane (ex: proxy settings, retry counts, etc).
      See Also:
    • AWSIotDataAsyncClient

      public AWSIotDataAsyncClient(AWSCredentials awsCredentials)
      Constructs a new asynchronous client to invoke service methods on AWS IoT Data Plane using the specified AWS account credentials.

      Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default maximum number of concurrent connections to the service).

      Parameters:
      awsCredentials - The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
      See Also:
    • AWSIotDataAsyncClient

      public AWSIotDataAsyncClient(AWSCredentials awsCredentials, ExecutorService executorService)
      Constructs a new asynchronous client to invoke service methods on AWS IoT Data Plane using the specified AWS account credentials and executor service. Default client settings will be used.
      Parameters:
      awsCredentials - The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
      executorService - The executor service by which all asynchronous requests will be executed.
    • AWSIotDataAsyncClient

      public AWSIotDataAsyncClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService)
      Constructs a new asynchronous client to invoke service methods on AWS IoT Data Plane using the specified AWS account credentials, executor service, and client configuration options.
      Parameters:
      awsCredentials - The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
      clientConfiguration - Client configuration options (ex: max retry limit, proxy settings, etc).
      executorService - The executor service by which all asynchronous requests will be executed.
    • AWSIotDataAsyncClient

      public AWSIotDataAsyncClient(AWSCredentialsProvider awsCredentialsProvider)
      Constructs a new asynchronous client to invoke service methods on AWS IoT Data Plane using the specified AWS account credentials provider. Default client settings will be used.

      Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default maximum number of concurrent connections to the service).

      Parameters:
      awsCredentialsProvider - The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
      See Also:
    • AWSIotDataAsyncClient

      public AWSIotDataAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration)
      Constructs a new asynchronous client to invoke service methods on AWS IoT Data Plane using the provided AWS account credentials provider and client configuration options.

      Asynchronous methods are delegated to a fixed-size thread pool containing a number of threads equal to the maximum number of concurrent connections configured via ClientConfiguration.getMaxConnections().

      Parameters:
      awsCredentialsProvider - The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
      clientConfiguration - Client configuration options (ex: max retry limit, proxy settings, etc).
      See Also:
    • AWSIotDataAsyncClient

      public AWSIotDataAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService)
      Constructs a new asynchronous client to invoke service methods on AWS IoT Data Plane using the specified AWS account credentials provider and executor service. Default client settings will be used.
      Parameters:
      awsCredentialsProvider - The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
      executorService - The executor service by which all asynchronous requests will be executed.
    • AWSIotDataAsyncClient

      public AWSIotDataAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, ExecutorService executorService)
      Constructs a new asynchronous client to invoke service methods on AWS IoT Data Plane using the specified AWS account credentials provider, executor service, and client configuration options.
      Parameters:
      awsCredentialsProvider - The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
      clientConfiguration - Client configuration options (ex: max retry limit, proxy settings, etc).
      executorService - The executor service by which all asynchronous requests will be executed.
  • Method Details

    • getExecutorService

      public ExecutorService getExecutorService()
      Returns the executor service used by this client to execute async requests.
      Returns:
      The executor service used by this client to execute async requests.
    • deleteThingShadowAsync

      public Future<DeleteThingShadowResult> deleteThingShadowAsync(DeleteThingShadowRequest request)
      Description copied from interface: AWSIotDataAsync

      Deletes the thing shadow for the specified thing.

      For more information, see DeleteThingShadow in the AWS IoT Developer Guide.

      Specified by:
      deleteThingShadowAsync in interface AWSIotDataAsync
      Parameters:
      request - The input for the DeleteThingShadow operation.
      Returns:
      A Java Future containing the result of the DeleteThingShadow operation returned by the service.
    • deleteThingShadowAsync

      Description copied from interface: AWSIotDataAsync

      Deletes the thing shadow for the specified thing.

      For more information, see DeleteThingShadow in the AWS IoT Developer Guide.

      Specified by:
      deleteThingShadowAsync in interface AWSIotDataAsync
      Parameters:
      request - The input for the DeleteThingShadow operation.
      asyncHandler - Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.
      Returns:
      A Java Future containing the result of the DeleteThingShadow operation returned by the service.
    • getThingShadowAsync

      public Future<GetThingShadowResult> getThingShadowAsync(GetThingShadowRequest request)
      Description copied from interface: AWSIotDataAsync

      Gets the thing shadow for the specified thing.

      For more information, see GetThingShadow in the AWS IoT Developer Guide.

      Specified by:
      getThingShadowAsync in interface AWSIotDataAsync
      Parameters:
      request - The input for the GetThingShadow operation.
      Returns:
      A Java Future containing the result of the GetThingShadow operation returned by the service.
    • getThingShadowAsync

      Description copied from interface: AWSIotDataAsync

      Gets the thing shadow for the specified thing.

      For more information, see GetThingShadow in the AWS IoT Developer Guide.

      Specified by:
      getThingShadowAsync in interface AWSIotDataAsync
      Parameters:
      request - The input for the GetThingShadow operation.
      asyncHandler - Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.
      Returns:
      A Java Future containing the result of the GetThingShadow operation returned by the service.
    • publishAsync

      public Future<PublishResult> publishAsync(PublishRequest request)
      Description copied from interface: AWSIotDataAsync

      Publishes state information.

      For more information, see HTTP Protocol in the AWS IoT Developer Guide.

      Specified by:
      publishAsync in interface AWSIotDataAsync
      Parameters:
      request - The input for the Publish operation.
      Returns:
      A Java Future containing the result of the Publish operation returned by the service.
    • publishAsync

      public Future<PublishResult> publishAsync(PublishRequest request, AsyncHandler<PublishRequest,PublishResult> asyncHandler)
      Description copied from interface: AWSIotDataAsync

      Publishes state information.

      For more information, see HTTP Protocol in the AWS IoT Developer Guide.

      Specified by:
      publishAsync in interface AWSIotDataAsync
      Parameters:
      request - The input for the Publish operation.
      asyncHandler - Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.
      Returns:
      A Java Future containing the result of the Publish operation returned by the service.
    • updateThingShadowAsync

      public Future<UpdateThingShadowResult> updateThingShadowAsync(UpdateThingShadowRequest request)
      Description copied from interface: AWSIotDataAsync

      Updates the thing shadow for the specified thing.

      For more information, see UpdateThingShadow in the AWS IoT Developer Guide.

      Specified by:
      updateThingShadowAsync in interface AWSIotDataAsync
      Parameters:
      request - The input for the UpdateThingShadow operation.
      Returns:
      A Java Future containing the result of the UpdateThingShadow operation returned by the service.
    • updateThingShadowAsync

      Description copied from interface: AWSIotDataAsync

      Updates the thing shadow for the specified thing.

      For more information, see UpdateThingShadow in the AWS IoT Developer Guide.

      Specified by:
      updateThingShadowAsync in interface AWSIotDataAsync
      Parameters:
      request - The input for the UpdateThingShadow operation.
      asyncHandler - Asynchronous callback handler for events in the lifecycle of the request. Users can provide an implementation of the callback methods in this interface to receive notification of successful or unsuccessful completion of the operation.
      Returns:
      A Java Future containing the result of the UpdateThingShadow operation returned by the service.
    • shutdown

      public void shutdown()
      Shuts down the client, releasing all managed resources. This includes forcibly terminating all pending asynchronous service calls. Clients who wish to give pending asynchronous service calls time to complete should call getExecutorService().shutdown() followed by getExecutorService().awaitTermination() prior to calling this method.
      Specified by:
      shutdown in interface AWSIotData
      Overrides:
      shutdown in class AmazonWebServiceClient