Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] - Relying on MQTTAsync_deliveryComplete for QOS 0

Paulo Balbino <paulo.indusoft@xxxxxxxxx> writes:

>    I have an application that publishes data using MQTT (paho C API) and I
> am having some issues when publishing message with QoS zero, I am
> publishing 100 one after the other, for some of them the
> function  MQTTAsync_deliveryComplete is not being called, I am using QoS
> zero for all of them.
> Question: Should I rely on  MQTTAsync_deliveryComplete  even for QoS zero?
> Or should I just send since QoS zero is considered "Fire and Forget"?

I read the documentation:

and find it ambiguous.  Given that there is no acknowledgement from the
server for qos0, I don't know what "notification of delivery of messages
to the server" means.  Were I writing code, I'd have to interpret it as
either 1) don't ever call it for qos0, because there is no notification,
2) call it if the write call on the socket doesn't have an error return
or 3) call it if some message, even a keepalive, that was sent after the
qos0 message is acked.  My inclination would be to pick 2 and update the
function docs to say that.

I would suggest:
  setting a onnection lost callback also
  in your tests, seeing if each of the 100 messages actually arrives at
  the broker, and comparing any missing messages to missing callbacks

  reading the code to see if there are paths where qos0 messages are
  dropped due to lack of buffer space, e.g. on the socket that
  represents the TCP connection to the broker

Back to the top