Open aminmesbahi opened 1 year ago
I'm not sure I understand exactly all points. Can you maybe share the whole code to reproduce the issue?
In which case do you get the output from point 2? After calling DisconnectAsync()
on the broker?
The IMqttClientConnectedCallback
is not working at all or what's the behavior you are experiencing?
IMqttClientDisconnectingCallback
is called when you disconnect the broker via DisconnectAsync()
(or when the application is shutting down). The connection is managed internally and retried in case of failures.
It would probably be more correct to invoke a callback also in this case, when the connection is dropped. What's your use case?
Firstly, thanks for your quick response :)
1: When the ActiveMQ is unavailable, I receive the log mentioned in "2". Also, in this situation, the "publisher.PublishAsync" method does not drop in the catch block.
2: The IMqttClientConnectedCallback
does not work in all scenarios I've tested.
Generally speaking, I want to handle situations where ActiveMQ is not available. For example: try five times to connect and then kill the process or send a notification to the admin
Which QoS level are you setting for the produced messages? You should definitely get an exception when producing with QoS >= 1.
For monitoring and alarming purpose you could try to rely on logs and health checks.
By the way, Silverback autonomously retries and reconnects, you don't have to take care of this aspect.