eclipse / paho.mqtt.java

Eclipse Paho Java MQTT client library. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
2.1k stars 880 forks source link

`MqttConnectionOptions` docs lie about default automatic reconnect #974

Open inad9300 opened 1 year ago

inad9300 commented 1 year ago

The docs on top of the class say that, by default:

https://github.com/eclipse/paho.mqtt.java/blob/f4e0db802a4433645ef011e711646a09ec9fae89/org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/MqttConnectionOptions.java#L49

But guess what? The default value is no automatic reconnection:

https://github.com/eclipse/paho.mqtt.java/blob/f4e0db802a4433645ef011e711646a09ec9fae89/org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/MqttConnectionOptions.java#L61

To double-check:

var options = new MqttConnectionOptions();
System.out.println("isAutomaticReconnect? " + options.isAutomaticReconnect()); // Prints "false".