MQTT incorrect message id in publish failure response

Hi,

I’m currently developing an application using EG25-G modules, using the built in MQTT commands. I am currently testing the error handling parts of my application and have found something that looks like a bug in the response provided to a AT+QMTPUBEX message when the message can’t be delivered.

To test this, I am:

  1. starting my application
  2. allowing it to connect to my MQTT broker
  3. subscribing to some topics
  4. publishing some initial data. (this is successful)

Then, after a short time I am:

  1. disconnecting my broker from the internet (pulling the ethernet cable out of the machine running it) to force a transmission failure on my device.
  2. waiting a few seconds
  3. getting my device to try and publish some more data (QoS = 1)

As expected, the publishing fails and I get responses indicating retry attempts (result=1, value=1), (result=1, value=2), (result=1, value=3). However, despite the message id in the publish request being > 0, the message id in these responses is always == 0, therefore it is not possible to match up these responses with the message that failed to be published.

Could you please let me know if this is expected behaviour ? or if the message id should match that of the publish request ?

Thanks

Hi Lee,

That would be expected behavior. A client will maintain its own list of Message IDs separate to the Message IDs used by the server it is connected to.
And the msgID in response “+QMTPUBEX: <client_idx>,,[,]” is read from server. It will show 0 if server don’t response the publish message.
We suggest publishing msg one by one.

Fortunately I am only publishing messages one by one. Thanks for the response, I know now I can ignore that field in this case (maybe the documentation could be improved to explain that in this case that field will always be zero).

OK. Thanks for your suggestion.