Example usage for com.amazonaws.services.iotdata AWSIotDataClient AWSIotDataClient

List of usage examples for com.amazonaws.services.iotdata AWSIotDataClient AWSIotDataClient

Introduction

In this page you can find the example usage for com.amazonaws.services.iotdata AWSIotDataClient AWSIotDataClient.

Prototype

AWSIotDataClient(AwsSyncClientParams clientParams) 

Source Link

Document

Constructs a new client to invoke service methods on AWS IoT Data Plane using the specified parameters.

Usage

From source file:com.erudika.para.iot.AWSIoTService.java

License:Apache License

protected AWSIotDataClient getDataClient() {
    if (iotDataClient != null) {
        return iotDataClient;
    }//ww  w  .  j a v  a  2s .com

    Region region = Regions.getCurrentRegion();
    region = region != null ? region : Region.getRegion(Regions.fromName(Config.AWS_REGION));
    iotDataClient = new AWSIotDataClient(new BasicAWSCredentials(Config.AWS_ACCESSKEY, Config.AWS_SECRETKEY))
            .withRegion(region);

    Para.addDestroyListener(new DestroyListener() {
        public void onDestroy() {
            shutdownDataClient();
        }
    });

    return iotDataClient;
}