agent
agent copied to clipboard
agent stop to relay messages to nats when disconnects and reconnects to mqtt
steps to reproduce
- start the agent and send commands from a mainflux instance
- simulate a connection issue and wait agent to notify the disconnection
- re-enable the connection and wait agent to notify the reconnection
expected
commands and service messages (channels/
actual
agent stops to relay commands until the service is restarted
imo the issue is related to the Paho clean session flag that is set to "true" in the config. when paho disconnects and auto reconnects, seems that it does not re-subscribe to the mqtt topics that the broker has wiped out when client disconnected. In fact, when changing clean session
to false
, the agent works as expected.
Are there any drawbacks in setting the session as persistent (clean session = false)? If not i can open a PR. A more involed solution is to use the paho handlers to re-subscribe to the topics when connection is lost. If a clean session is needed when the service process starts / restarts, there is also this workaround to have a cleaned persistent session