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
860 stars 159 forks source link

Ability to add a subscription listener to the client builder (like connected and disconnected) #510

Open richturner opened 2 years ago

richturner commented 2 years ago

Problem or use case

When the client auto re-connects it tries to re-subscribe previous subscriptions (at least it does when the conack doesn't report a session is present) but these subscriptions can fail (in my case authorisation rules have changed on the broker which is why the client was disconnected by the broker).

It doesn't seem possible to get notified of these re-subscribe failures.

Preferred solution or suggestions

It would be great if we could add a subscribeListener to the client builder similar to the connected and disconnected listeners. This would allow us to act on the failure just like calling client subscribeWith()