Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] When to send publish acknowledgements

"Allan Stockdill-Mander" <asm@xxxxxxxxxx> writes:

> I've had a PR for the v5 golang client
> https://github.com/eclipse/paho.golang/pull/52 that changes the
> behaviour so that Publish messages are only acknowledged (the puback
> or pubrec sent) after the associated message handlers have been
> invoked and returned. I can see a benefit to doing this for the
> application as you effectively don't need to have incoming message
> persistence, until you have processed the message if the client dies
> and reconnects the server should resend any unacked messages.

I don't see that spec bit as being about this question.   The real
question is if the ack is supposed to come from the MQTT processing step
or from a client having done something and committed the results to
stable storage.

An analog is TCP acks: the TCP implementation (typically in kernel) acks
bytes, nad merely places them in a buffer for the process to read or not
get around to reading.

So the big Q is what does the spec stay about when something should be
acked:

  when the MQTT code has received it

  when it has been read/accessed by some user code

  when that user code has decided that it has finished the processing
  that it wants to do


My overall sense, very very fuzzy and take it with a big grain of salt,
is that pub/ack is about network loss only, and is not meant to support
some sort of transaction commit all the way to the processing code.

It is then a good question how to build a system that does what you
want, and perhaps the answer is to send a higher-level ack as an MQTT
message.

Hope this helps at least explain why I'm not quite following you.

Attachment: signature.asc
Description: PGP signature


Back to the top