paho.mqtt.java
paho.mqtt.java copied to clipboard
Eclipse Paho Automatic Reconnect configure
As provided in documentation of java client's automaticReconnect feature:
Once the client has been disconnected, the client will attempt to connect with an increasing time interval. Starting at 1 second, doubling on each failed attempt up to 2 minutes.
But It raises some questions over client behavior:
-
After 2 minutes limit, Will client keep trying to connect indefinitely? As I am not able to find any other parameter to control this iteration.
-
Is there any way available to configure this interval ?
Hi @sachingupta141, once the interval reaches 2 minutes, the client will then attempt to reconnect every 2 minutes until either successful or being stopped. There currently isn't any way to change this behaviour, however we'd be open to a pull request to add it in.
Hi @jpwsutton , is there any new about this pull request ? I'm highly interested with the possibility to configure the maximum retry interval.
I'm thinking to use the java paho client in an application that will bridge 2 MQTT brokers. I need that the client reconnects every second. For the time being, I will do it programmatically in my application.
@asanglard Nobody has contributed a PR with this fix yet, I'll add this to the enhancement backlog for now.
Bump. We just need to configure the reconnect timeout (3 seconds constant) and it was very diffucult. We've ended up copying the java file and changing few lines there.
automaticReconnectMinDelay and automaticReconnectMaxDelay in MqttConnectOptions.
automaticReconnectMinDelay and automaticReconnectMaxDelay in MqttConnectOptions.
see #864