-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to handle onConnectionInterrupted callback due to connection close in 24 hours #771
Comments
The client will always reconnect in the scenario you have described. If you have CRT logs showing otherwise, please attach them. Also, this issue would best belong in the v2 Java SDK repository. |
Created new issue in v2 Java SDK repository with the error log. aws/aws-iot-device-sdk-java-v2#607 |
Also, Can you explain this line "The client will always reconnect in the scenario you have described." Did you mean, the client reconnects automatically or the client needs to fire some code to reconnect ? |
"the client reconnects automatically" |
Closing this in favor of the other issue that you opened |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
We are creating MQTT connection(software.amazon.awssdk.crt.mqtt.MqttClientConnection) over WebSocket using IAM Role credentials. The connection gets successfully created and we are able to listen to incoming events.
However, we noticed that MQTT connection gets closed unexpectedly in 24 hours due to IOT Core limitation. And the connection does not resume automatically.
This is the code.
{
final EventLoopGroup eventLoopGroup = new EventLoopGroup(1);
final ClientBootstrap clientBootstrap = new ClientBootstrap(eventLoopGroup,
new HostResolver(eventLoopGroup));
}
We receive error code: 5134 and error message "string: The connection was closed unexpectedly. for MQTT topic: ". in onConnectionInterrupted() callback method.
We tried to call mqttSecondaryConnection.connect().get(10, TimeUnit.SECONDS); as reconnect() in onConnectionInterrupted() callback method but we received:
java.util.concurrent.ExecutionException: software.amazon.awssdk.crt.CrtRuntimeException: MqttClientConnection.mqtt_connect: aws_mqtt_client_connection_connect failed (aws_last_error: AWS_ERROR_MQTT_ALREADY_CONNECTED(5132), The requested operation is invalid as the connection is already open.) AWS_ERROR_MQTT_ALREADY_CONNECTED(5132) at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) ~[?:?] at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096) ~[?:?] at ...
Can anybody help, how to reconnect in this case ?
Expected Behavior
The connection should resume automatically.
Current Behavior
The connection does not resume in this case.
Reproduction Steps
Create the fresh connection after 24 hours to see the connection closure after 24 hours.
Possible Solution
No response
Additional Information/Context
No response
SDK version used
JDK17
Environment details (OS name and version, etc.)
IOT Core
The text was updated successfully, but these errors were encountered: