# Issues in persisting messages in MQTT Broker using NodeRed MQTT Nodes

**URL:** <https://discourse.nodered.org/t/issues-in-persisting-messages-in-mqtt-broker-using-nodered-mqtt-nodes/4666>\
**Category:** General\
**Created:** [8 November 2018 04:51 UTC](https://discourse.nodered.org/t/issues-in-persisting-messages-in-mqtt-broker-using-nodered-mqtt-nodes/4666 "2018-11-08T04:51:02Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 November 2018 16:51 UTC](https://discourse.nodered.org/t/issues-in-persisting-messages-in-mqtt-broker-using-nodered-mqtt-nodes/4666/21 "2018-11-20T16:51:46Z")

</div>

> [@themesaul](#):
>
> I have a FIFO queue

If you already do it with a FIFO why are you asking for help?

---

<div class="post-metadata">

**Author:** ![themesaul](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@themesaul](https://discourse.nodered.org/u/themesaul)\
**Post date:** [20 November 2018 16:59 UTC](https://discourse.nodered.org/t/issues-in-persisting-messages-in-mqtt-broker-using-nodered-mqtt-nodes/4666/22 "2018-11-20T16:59:09Z")

</div>

I wanted to know what was the right way to do it or if there was some better way. I also wanted to say it to help anyone who needs to visit this thread over the coming years

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 November 2018 17:04 UTC](https://discourse.nodered.org/t/issues-in-persisting-messages-in-mqtt-broker-using-nodered-mqtt-nodes/4666/23 "2018-11-20T17:04:26Z")

</div>

OK, I think a FIFO is certainly the way to do it. Which sort of FIFO doesn't really matter provided it meets your requirements. One implementation detail is not to bother putting in any extra logic to test whether the FIFO is empty when a new message comes along. It is not worth the effort and the logic gets surprisingly complex. Just shove the new in the FIFO and then you can trigger the polling if appropriate which will immediately send it and take it out.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 November 2018 17:23 UTC](https://discourse.nodered.org/t/issues-in-persisting-messages-in-mqtt-broker-using-nodered-mqtt-nodes/4666/24 "2018-11-20T17:23:18Z")

</div>

Also send each one before removing from the FIFO, and make sure that the recipient can cope with messages being repeated as, if the sender is reset after sending but before removing, then that message will be sent again later.

---

<div class="post-metadata">

**Author:** ![shanmukha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shanmukha/32/61181_2.png) [@shanmukha](https://discourse.nodered.org/u/shanmukha)\
**Post date:** [10 March 2022 10:32 UTC](https://discourse.nodered.org/t/issues-in-persisting-messages-in-mqtt-broker-using-nodered-mqtt-nodes/4666/25 "2022-03-10T10:32:48Z")

</div>

hi  
is this unsubscribing issue resloved?  
and regarding disabling the flow will ir unsubscribe? or will it just disonnect ?  
and when we stop the nodered itself from console will the client gets unsubsribe and then disconnect or just disconnects?  
thanks in advance for your time

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 March 2022 10:37 UTC](https://discourse.nodered.org/t/issues-in-persisting-messages-in-mqtt-broker-using-nodered-mqtt-nodes/4666/26 "2022-03-10T10:37:12Z")

</div>

Please stick to one thread.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 March 2022 10:37 UTC](https://discourse.nodered.org/t/issues-in-persisting-messages-in-mqtt-broker-using-nodered-mqtt-nodes/4666/27 "2022-03-10T10:37:17Z")

</div>

Closed on 10 March 2022 10:37 UTC



[Previous page](https://discourse.nodered.org/t/issues-in-persisting-messages-in-mqtt-broker-using-nodered-mqtt-nodes/4666.md?page=1)
