← Back to team overview

mosquitto-users team mailing list archive

Re: 回复: I met a strange question

 

Hello,

>         1.delete mosquitto.db then restart mosquitto 
>         2. pub a qos 2 message without sub 
>         3. restart subscriber and cannot receive message any more.

If you intend to be able to get messages previously published to the
broker (i.e. retained *by* the broker), you have to set the `retain'
flag on messages as you publish them. With the command-line tools, you'd
do something like this:

        mosquitto_pub -t topic -m payload -r

A subsequent SUB on that topic (provided ACLs allow you to do so) will
read that last retained message for that particular topic.

        -JP


Follow ups

References