← Back to team overview

mosquitto-users team mailing list archive

Re: (no subject)

 

Hi Patrick,

You can remove retained messages by publishing a zero length retained
message to the same topic. So if you were using mosquitto_pub, you
could set a retained message like this:

mosquitto_pub -t my/topic -m message -r

And to clear it:

mosquitto_pub -t my/topic -r -n


I don't think this is the best way for you to approach your problem
though. Using "clean session"=false with your client means that the
broker keeps subscriptions for your client even when it disconnects.
If your subscriptions and incoming messages have QoS>0 (or you are
using the non-standard queue_qos0_messages option with QoS=0 subs and
messages) then messages that are received for your client will be
queued up until it reconnects. The advantage here is that you get all
of the messages (up to the max_queued_messages limit) whereas using
retained messages only gets the most recent message.

I hope that helps.

Cheers,

Roger


On Tue, Apr 16, 2013 at 7:47 PM, Nelsen, Patrick
<Patrick.Nelsen@xxxxxxxxxxxxxxx> wrote:
> Hi all,
>
> I'm using MQTT with several embedded devices that will frequently post to a
> mosquito broker every 15 minutes.  In addition, I have an MQTT client that
> is gathering data and placing it in a database.  When running a long test, I
> noticed that my database client dropped its connection with the broker
> briefly and messages were missed because my devices were not publishing with
> the retain bit set.  In order to prevent this type of "data loss" (when a
> client is not currently subscribed), I figured that I could set the retain
> bit to 1.  However, when I do this my mosquito broker becomes saturated with
> messages and each time I drop connection I receive all of the previously
> published data.  Is there a way to tell the mosquito broker that it can
> remove its persisted entries?
>
>
>
> Patrick
>
>
>
>
>
>
> --
> Mailing list: https://launchpad.net/~mosquitto-users
> Post to     : mosquitto-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~mosquitto-users
> More help   : https://help.launchpad.net/ListHelp
>


References