# Like traffic lights but resending only most recent message

**URL:** <https://discourse.nodered.org/t/like-traffic-lights-but-resending-only-most-recent-message/43295>\
**Category:** General\
**Created:** [27 March 2021 19:50 UTC](https://discourse.nodered.org/t/like-traffic-lights-but-resending-only-most-recent-message/43295 "2021-03-27T19:50:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxym](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/maxym/32/35240_2.png) [@maxym](https://discourse.nodered.org/u/maxym)\
**Post date:** [27 March 2021 19:50 UTC](https://discourse.nodered.org/t/like-traffic-lights-but-resending-only-most-recent-message/43295/1 "2021-03-27T19:50:25Z")

</div>

hello  
What I want to achieve is functionality of controlled message flow with memorizing of most recent blocked one in order to send it when flow is allowed again.

Just imagine messages sent with some frequency. Those messages are blocked by traffic lights node. When traffic lights turns into "allow" mode, it resends only the most recent message blocked.

Current implementation of traffic lights resends all messages collected during "blocked" state (btw curious if there are any memory considerations). I would like to resent only most recent one.  
I tried to incorporate delay node configured to rate limit mode, but it passes only the first message, dropping all others.

I could achieve what I want with use of flow or env variable but maybe there is "smarter" method.

thank you in advance

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 March 2021 20:16 UTC](https://discourse.nodered.org/t/like-traffic-lights-but-resending-only-most-recent-message/43295/2 "2021-03-27T20:16:02Z")

</div>

I originally liked that node but have since gone to this one.

[It may not exactly be what you want, but the support is still happening.](https://flows.nodered.org/node/node-red-contrib-simple-gate)

And there is also a `q-gate` node by the same person which may do what you need.

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [27 March 2021 20:56 UTC](https://discourse.nodered.org/t/like-traffic-lights-but-resending-only-most-recent-message/43295/3 "2021-03-27T20:56:20Z")

</div>

> [@maxym](#):
>
> I would like to resent only most recent one.

[Node-red-contrib-queue-gate](https://flows.nodered.org/node/node-red-contrib-queue-gate) can be configured to send the most recent message when triggered. In fact, one of the examples distributed with the node does exactly that.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 May 2021 20:56 UTC](https://discourse.nodered.org/t/like-traffic-lights-but-resending-only-most-recent-message/43295/4 "2021-05-26T20:56:46Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
