Open climategadgets opened 3 years ago
Hi @climategadgets Although you are right that we should cover the most common unrecoverable problems in the default automatic reconnect, you can currently already do this manually, for example:
Mqtt5Client.builder()
...
.automaticReconnectWithDefaultConfig()
.addDisconnectedListener(context -> {
if (isUnrecoverable(context.getCause())) {
context.getReconnector().reconnect(false);
}
})
...
Expected behavior
connect()
fails even if configured to reconnect if it is determined that reconnect attempts will always fail. Case in point, attempts to connect to MQTT 3 only broker with MQTT 5 only client will never succeed and must be abandoned with a clear error message.See also: #302
Actual behavior
connect()
hangs with no indication of why.To Reproduce
Steps
With automatic reconnect enabled,
Invalid protocol version 5 in CONNECT from ${client_ip}
), orSocket error on client <unknown>, disconnecting.
), orReproducer code
Standard
connect()
code from HiveMQ examplesDetails
openjdk version "11.0.11" 2021-04-20
mosquitto 1.5.7-1+deb10u1