Skip to content

Commit

Permalink
fix: use max session expiry sec supported by AWS IoT Core (#1646)
Browse files Browse the repository at this point in the history
  • Loading branch information
saranyailla authored Jul 23, 2024
1 parent 865be65 commit f72ad92
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<AwsIotMqtt5ClientBuilder> builderProvider;

private Mqtt5Client client = null;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit f72ad92

Please sign in to comment.