Skip to main content

Timeline for How to process the MQTT queue once?

Current License: CC BY-SA 3.0

7 events
when toggle format what by license comment
Apr 7, 2018 at 13:39 vote accept WoJ
Apr 6, 2018 at 12:34 comment added hardillb It's that or keep a list of the topics that you've already processed and ignore new messages on those topics
Apr 6, 2018 at 12:32 comment added hardillb In that case you may be better looking for a broker with an admin interface that lets you dump all retained message instantaneously on command than trying to do it from another client.
Apr 6, 2018 at 12:20 comment added WoJ They could publish 1 ms before you start this "clean" You are absolutely right. I cannot do anything for existing relevant retained messages (they should be updated via telemetry after some time, hopefully) but I also do not want to wait longer than necessary so that future relavant retained messages (the ones which may pop-up during my cleanup) are less likely to be nuked. This is why I wanted to process only once the existing queue (made of correct and legacy retained messages) and do not take into account future ones. I currently have a 2 seconds window to allow or messages to be gathered
Apr 6, 2018 at 12:14 comment added hardillb Yes, but you can't do this with the publishers running as you have no way of knowing when they will publish a new retained message. They could publish 1 ms before you start this "clean"
Apr 6, 2018 at 10:59 comment added WoJ The idea to check the retained flag is very good - it will filter out the other messages. Thanks. This does not however solve my problem of processing the queue only once: if I leave a loop_forever() then new (legitimate) retained messages would be cleaned as well. My intent is to clean up the queue from old messages (irrelevant at that point) but not break the retention capability (by cleaning up as soon as a new retained message arrives)
Apr 6, 2018 at 7:51 history answered hardillb CC BY-SA 3.0