Thales' cellular IoT products business is now part of Telit Cinterion, find out more.

You are here

MQTT reconnection | Telit Cinterion IoT Developer Community

February 23, 2021 - 10:59am, 1657 views

Good Morning.

Cinterion
EHS6
REVISION 03.001
A-REVISION 00.000.51

I am using the MQTT library "MqttClient2016.jar" taken from: https://iot-developer.thalesgroup.com/comment/9842#comment-9842

The connection works perfectly for me and receives the messages without any problem.

I have the problem if the internet connection is lost, or if the server is restarted. It does not reconnect. I configure the options with the following command:

  connOpts.setAutomaticReconnect (true);

as indicated by the main class in the example.

I use the MyMqttCallback interface that also appears in the main class.

When the connection is lost, I get the message "[MyMqttCallback]: Connection lost because"

So it detects the loss, but then it does nothing more, and I keep sending messages and it does not receive them again once the connection is lost.

Should I do anything else to make the reconnection work?
Or should I do this reconnection on my own?

Thank you!