paho.mqtt.java icon indicating copy to clipboard operation
paho.mqtt.java copied to clipboard

Eclipse Paho Automatic Reconnect configure

Open sachingupta141 opened this issue 8 years ago • 6 comments
trafficstars

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:

  1. 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.

  2. Is there any way available to configure this interval ?

sachingupta141 avatar Jun 07 '17 11:06 sachingupta141

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.

jpwsutton avatar Jun 08 '17 08:06 jpwsutton

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 avatar Jul 02 '17 14:07 asanglard

@asanglard Nobody has contributed a PR with this fix yet, I'll add this to the enhancement backlog for now.

jpwsutton avatar Jul 24 '17 10:07 jpwsutton

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.

Pitel avatar Sep 20 '17 10:09 Pitel

automaticReconnectMinDelay and automaticReconnectMaxDelay in MqttConnectOptions.

icraggs avatar Nov 21 '18 19:11 icraggs

automaticReconnectMinDelay and automaticReconnectMaxDelay in MqttConnectOptions.

see #864

mrpiggi avatar Nov 02 '23 22:11 mrpiggi