hivemq / hivemq-mqtt-client

HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support
https://hivemq.github.io/hivemq-mqtt-client/
Apache License 2.0
824 stars 153 forks source link

Make Reconnect Failure Behavior Configurable #622

Open pglombardo opened 4 months ago

pglombardo commented 4 months ago

🚀 Feature Request

Currently, when using automaticReconnectWithDefaultConfig, the client may hang indefinitely if it can't reconnect to the broker.

As pointed out (and requested by @dowhiletrue in #302), users would like the ability to configure this behavior to either:

There are three options on top of my mind:

  • block
  • throw
  • continue and try to connect later

Which option fits best depends on the use-case. Make the behavior configurable?

🔈 Motivation

🛰 Alternatives

For the existing behaviour, a work-around was provided by @SgtSilvio here.

📎 Additional context