From f72ad92863362bceeb3f7ad232ccf7b7fa452cc5 Mon Sep 17 00:00:00 2001 From: Saranya Date: Tue, 23 Jul 2024 15:55:47 -0700 Subject: [PATCH] fix: use max session expiry sec supported by AWS IoT Core (#1646) --- .../java/com/aws/greengrass/mqttclient/AwsIotMqtt5Client.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/aws/greengrass/mqttclient/AwsIotMqtt5Client.java b/src/main/java/com/aws/greengrass/mqttclient/AwsIotMqtt5Client.java index e55869e773..28288edef9 100644 --- a/src/main/java/com/aws/greengrass/mqttclient/AwsIotMqtt5Client.java +++ b/src/main/java/com/aws/greengrass/mqttclient/AwsIotMqtt5Client.java @@ -72,6 +72,7 @@ class AwsIotMqtt5Client implements IndividualMqttClient { static final String TOPIC_KEY = "topic"; private static final String RESUB_LOG_EVENT = "resubscribe"; + private static final long DEFAULT_SESSION_EXPIRY_SECONDS = 604_800L; // Maximum time supported by AWS IoT Core private final Provider builderProvider; private Mqtt5Client client = null; @@ -346,7 +347,7 @@ private void internalConnect() { .withReceiveMaximum(Coerce.toLong(mqttTopics.findOrDefault(100L, "receiveMaximum"))) .withSessionExpiryIntervalSeconds( - Coerce.toLong(mqttTopics.findOrDefault(10_080L, + Coerce.toLong(mqttTopics.findOrDefault(DEFAULT_SESSION_EXPIRY_SECONDS, "sessionExpirySeconds")))); client = builder.build(); } catch (MqttException e) {