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

You are here

MQTT subscription messages not being received | Telit Cinterion IoT Developer Community

November 17, 2021 - 11:29pm, 2015 views

Recently I have noticed that the MQTT is not receiving the messages on the topic it subscribes to.

I am not sure if it is because I upgraded the FW or something.

To prove I am not doing anything wrong, I am using the example in SDK/examples/mqtt/mqtt.c file.

This example uses the qapi to connect and publish/subscribe to topics in MQTT.

I did several tests, and the example works for publishing, and I can see with other client that the data is being received.

Doing some investigation, I've noticed that on these steps:

1) ret = qapi_Net_MQTT_Set_Connect_Callback(_mqtt_handle, dam_mqtt_connect_callback);
2) qapi_Net_MQTT_Set_Subscribe_Callback(_mqtt_handle, dam_mqtt_subscribe_callback);
3) qapi_Net_MQTT_Set_Publish_Callback(_mqtt_handle, dam_mqtt_publish_callback);
4) qapi_Net_MQTT_Set_Message_Callback(_mqtt_handle, dam_mqtt_message_callback);

 

Over these callback steps (1), (2), (3), and (4), all of them have printfs to inform that the code has reached that point or not.

Only (1) and (3) is being reached.

I am not sure why it is not working.

On Mosquitto MQTT side, I can see that the module is connecting, subscribed to the topic, and it is publishing on the another topic. But the callbacks are not called. And if I publish from a different client on the topic the module is subscribed to, nothing happens.

Logs of the Mosquitto:

1637192161: mosquitto version 2.0.10 starting
1637192161: Config loaded from /etc/mosquitto/conf.d/default.conf.
1637192161: Opening ipv4 listen socket on port 1883.
1637192161: mosquitto version 2.0.10 running

1637192206: New connection from ***.***.***5:1234 on port 1883.
1637192206: New client connected from ***.***.***:1234 as mqtt_client1 (p2, c1, k60, u'mqtt_user1').
1637192206: Will message specified (37 bytes) (r0, q0).
1637192206: 	mqttwill
1637192206: Sending CONNACK to mqtt_client1 (0, 0)
1637192206: Received SUBSCRIBE from mqtt_client1
1637192206: 	mqtttest (QoS 0)
1637192206: mqtt_client1 0 mqtttest
1637192206: Sending SUBACK to mqtt_client1
1637192216: Received PUBLISH from mqtt_client1 (d0, q2, r0, m24475, 'counter', ... (17 bytes))
1637192216: Sending PUBREC to mqtt_client1 (m24475, rc0)
1637192217: Received PUBREL from mqtt_client1 (Mid: 24475)
1637192217: Sending PUBCOMP to mqtt_client1 (m24475)
1637192260: Received PUBLISH from mqtt_client1 (d0, q2, r0, m15846, 'counter', ... (17 bytes))
1637192260: Sending PUBREC to mqtt_client1 (m15846, rc0)
1637192260: Received PUBLISH from mqtt_client1 (d1, q2, r0, m15846, 'counter', ... (17 bytes))
1637192260: Sending PUBREC to mqtt_client1 (m15846, rc0)
1637192260: Received PUBLISH from mqtt_client1 (d0, q2, r0, m9052, 'counter', ... (17 bytes))
1637192260: Sending PUBREC to mqtt_client1 (m9052, rc0)

But again, the code is the same as in the SDK/examples/mqtt folder.

=========================

Details of the module:

EXS82-W A2.4

ati1
Cinterion
EXS82-W
REVISION 01.100
A-REVISION 01.000.14

OK