Closed pravingaikwad07 closed 7 months ago
Hi @pravingaikwad07 - apologies for the late reply. To enable auto reconnect, see this example:
final Mqtt5BlockingClient client2 = Mqtt5Client.builder()
.serverHost("broker.hivemq.com")
.automaticReconnect()
.initialDelay(3, TimeUnit.SECONDS)
.maxDelay(10, TimeUnit.SECONDS)
.applyAutomaticReconnect()
.addConnectedListener(context -> System.out.println("connected " + LocalTime.now()))
.addDisconnectedListener(context -> System.out.println("disconnected " + LocalTime.now()))
.buildBlocking();
This example is from here.
This should answer your question. Given the age of this issue I'll close this out. If anything remains, let us know. We'd be more than happy to help out!
🚀 Feature Request
Auto reconnection
🔈 Motivation
Is there a way to implement auto reconnect in case of timeout or network issues and restore the lost publish and subscribe events?
🛰 Alternatives
📎 Additional context