From 8d4205fef79298c8626820eb5da42b99328b3bb7 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 16 Mar 2021 12:10:06 -0700 Subject: [PATCH] update CRT and expose timeout for request (#145) --- README.md | 6 +++--- android/app/build.gradle | 2 +- android/iotdevicesdk/build.gradle | 2 +- sdk/pom.xml | 2 +- .../awssdk/iot/AwsIotMqttConnectionBuilder.java | 12 ++++++++++++ 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bffda050c..8068abc87 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ mvn clean install ``` sh # NOTE: use the latest version of the CRT here -git clone --branch v0.10.10 https://github.com/awslabs/aws-crt-java.git +git clone --branch v0.11.2 https://github.com/awslabs/aws-crt-java.git git clone https://github.com/awslabs/aws-iot-device-sdk-java-v2.git cd aws-crt-java @@ -65,7 +65,7 @@ Supports API 26 or newer. NOTE: The shadow sample does not currently complete on android due to its dependence on stdin keyboard input. ``` sh -git clone --recursive --branch v0.10.10 https://github.com/awslabs/aws-crt-java.git +git clone --recursive --branch v0.11.2 https://github.com/awslabs/aws-crt-java.git git clone https://github.com/awslabs/aws-iot-device-sdk-java-v2.git cd aws-crt-java/android ./gradlew connectedCheck # optional, will run the unit tests on any connected devices/emulators @@ -86,7 +86,7 @@ repositories { } dependencies { - implementation 'software.amazon.awssdk.crt:android:0.10.10' + implementation 'software.amazon.awssdk.crt:android:0.11.2' } ``` diff --git a/android/app/build.gradle b/android/app/build.gradle index 7d5903b4a..9b704e003 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -50,7 +50,7 @@ repositories { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(":iotdevicesdk") - implementation 'software.amazon.awssdk.crt:android:0.10.10' + implementation 'software.amazon.awssdk.crt:android:0.11.2' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.core:core:1.2.0' diff --git a/android/iotdevicesdk/build.gradle b/android/iotdevicesdk/build.gradle index 686ba38dc..f50641e7b 100644 --- a/android/iotdevicesdk/build.gradle +++ b/android/iotdevicesdk/build.gradle @@ -87,7 +87,7 @@ repositories { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'software.amazon.awssdk.crt:android:0.10.10' + implementation 'software.amazon.awssdk.crt:android:0.11.2' implementation 'com.google.code.gson:gson:2.8.5' implementation 'androidx.appcompat:appcompat:1.1.0' testImplementation 'junit:junit:4.12' diff --git a/sdk/pom.xml b/sdk/pom.xml index 0b222befe..eb3515a9f 100644 --- a/sdk/pom.xml +++ b/sdk/pom.xml @@ -42,7 +42,7 @@ software.amazon.awssdk.crt aws-crt - 0.10.10 + 0.11.2 junit diff --git a/sdk/src/main/java/software/amazon/awssdk/iot/AwsIotMqttConnectionBuilder.java b/sdk/src/main/java/software/amazon/awssdk/iot/AwsIotMqttConnectionBuilder.java index 0e7d4e162..5d445f131 100644 --- a/sdk/src/main/java/software/amazon/awssdk/iot/AwsIotMqttConnectionBuilder.java +++ b/sdk/src/main/java/software/amazon/awssdk/iot/AwsIotMqttConnectionBuilder.java @@ -228,6 +228,18 @@ public AwsIotMqttConnectionBuilder withPingTimeoutMs(int pingTimeoutMs) { return this; } + /** + * Controls timeout value for requests that response is required on healthy connection. + * If a response is not received within this interval, the request will fail as server not receiving it. + * Applied to publish (QoS>0) and unsubscribe + * + * @param protocolOperationTimeoutMs How long to wait for a request response (in milliseconds) before failing + */ + public AwsIotMqttConnectionBuilder withProtocolOperationTimeoutMs(int protocolOperationTimeoutMs) { + this.config.setProtocolOperationTimeoutMs(protocolOperationTimeoutMs); + return this; + } + /** * Configures the TCP socket connect timeout (in milliseconds) *