Will publishing

Skip to first unread message

Michael Combs

Feb 11, 2014, 4:30:06 PM2/11/14
to mq...@googlegroups.com
I have a few questions about WILL message publishing. There are several scenarios in which I am unsure if the WILL should be published. I understand that if the client sends a DISCONNECT then a broker should not publish the WILL. I am unsure about the scenarios below.

1) A client is connecting with the ID of an existing connected client. It is my understanding that the currently connected client connection should be closed and the new client should be connected. Should the will of the closed/previous client be published?

2) A client loses connection because of a network failure but immediately reconnects. Should the WILL be published or should the broker wait for some period (e.g. client timeout) before publishing the WILL. This seems unnecessary if the client immediately reconnects. 

3) A client sends a DISCONNECT message and immediately terminates the socket connection. The broker, depending on the processing model and message queue, could (and is very likely with async IO) recognize the connection termination before processing the DISCONNECT message. The broker now has to wait, set a timer, or look ahead in the mesage queue to see if there is DISCONNECT for the client. A wait time, possibly the broker keep alive timer, could resolve this issue as well as #2.

4) In the event that the broker must shut down. Should WILL messages be published for connected clients? If so, how, since the clients must all be disconnected before the shutdown? Do you publish the WILLs before disconnecting any clients so they all receive each others WILLS?

I am in the process of finishing a full featured interface driven extendable C# MQTT broker and client (including Netduino) which I hope to make available to the community. Thanks again for the help.

-Michael Combs

Paul Fremantle

Feb 11, 2014, 6:05:51 PM2/11/14
to mq...@googlegroups.com

I agree with a lot of your reasoning, but a strict reading of the spec would give:

1) Yes the will topic should be published
2) Yes the will topic should be published
3) No, the topic should not be published
4) Not clear from the spec. A strict reading of the spec would give rise to a random set of clients receiving some Will messages and others not.


PS Ideally you would submit this as a comment against the 3.1.1 public review (http://mqtt.org/2014/01/oasis-announce-30-day-public-review-for-mqtt-version-3-1-1).

PPS you have about one hour left to do that!

To learn more about MQTT please visit http://mqtt.org
You received this message because you are subscribed to the Google Groups "MQ Telemetry Transport" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+uns...@googlegroups.com.
To post to this group, send email to mq...@googlegroups.com.
Visit this group at http://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/groups/opt_out.

Paul Fremantle
Part-time PhD student - School of Computing
twitter: pzfreo / skype: paulfremantle / blog: http://pzf.fremantle.org
CTO and Co-Founder, WSO2
OASIS WS-RX TC Co-chair, Apache Member
07740 199 729

Michael Combs

Feb 24, 2014, 5:04:27 PM2/24/14
to mq...@googlegroups.com

Thanks Paul. I did just as you suggested and submitted for spec review.


Ian Craggs

Feb 25, 2014, 6:16:23 AM2/25/14
to mq...@googlegroups.com

from a practical viewpoint, implementing the previous spec, I'll tell you what I've done in the past:

1) No
2) Yes
3) Absolutely not - this is normal disconnect behaviour from the client
4) No, for practical considerations.  The will message processing will clutter up the shutdown processing and could cause all sorts of mayhem.


Richard J Coppen

Feb 25, 2014, 8:04:30 AM2/25/14
to Michael Combs, mq...@googlegroups.com
Hi Michael,

I've raised a Jira issue for the TC to investigate > https://tools.oasis-open.org/issues/browse/MQTT-192 <

Many thanks


Richard Coppen CEng FBCS  IBM United Kingdom
Software Engineer  Hursley Park
WebSphere MQ  Winchester
     SO21 2JN
Phone: +44 (0)1962 817164  England
e-mail: cop...@uk.ibm.com  
blog: testingblues.com  

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Reply all
Reply to author
0 new messages