# Flush delay node by topic

**URL:** <https://discourse.nodered.org/t/flush-delay-node-by-topic/49441>\
**Category:** Feature Requests\
**Created:** [7 August 2021 00:52 UTC](https://discourse.nodered.org/t/flush-delay-node-by-topic/49441 "2021-08-07T00:52:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![namgk](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/namgk/32/4050_2.png) [@namgk](https://discourse.nodered.org/u/namgk)\
**Post date:** [7 August 2021 00:52 UTC](https://discourse.nodered.org/t/flush-delay-node-by-topic/49441/1 "2021-08-07T00:52:52Z")

</div>

Hi there,

I think it's beneficial to have an option to flush the delay node by topic instead of flushing all the messages at once.

For example, there could be devices sending requests in (via http in node) that need to wait for an operator's command. The operator send in a command that's saved in the flow's context and flush the delay node. Eventually the command is returned to the devices via http response.

Here without a per-topic flushing mechanism, it's impossible to commanding individual devices.

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [7 August 2021 06:07 UTC](https://discourse.nodered.org/t/flush-delay-node-by-topic/49441/2 "2021-08-07T06:07:04Z")

</div>

How many different topics do you need to handle?

---

<div class="post-metadata">

**Author:** ![namgk](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/namgk/32/4050_2.png) [@namgk](https://discourse.nodered.org/u/namgk)\
**Post date:** [7 August 2021 16:56 UTC](https://discourse.nodered.org/t/flush-delay-node-by-topic/49441/3 "2021-08-07T16:56:27Z")

</div>

Hi Remo,

Technically unbounded? You don't know how many devices you're going to add.

Is that a problem?

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [7 August 2021 18:18 UTC](https://discourse.nodered.org/t/flush-delay-node-by-topic/49441/4 "2021-08-07T18:18:06Z")

</div>

Hi there,

I just thought if it's a fixed and low number of devices/topics you could do something like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cf66f996296a5150196c75e4c694dabbc36c7317.png)

```auto
[{"id":"7e94e34ce121c251","type":"delay","z":"8df064aa6876a7dd","name":"queue A","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":720,"y":180,"wires":[["3245e1f09c733145"]]},{"id":"43bbd21e4100a711","type":"inject","z":"8df064aa6876a7dd","name":"input A","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"A","payloadType":"date","x":230,"y":140,"wires":[["23bd36c10fb74e21"]]},{"id":"d98ef494c681b977","type":"inject","z":"8df064aa6876a7dd","name":"input B","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"B","payloadType":"date","x":230,"y":180,"wires":[["23bd36c10fb74e21"]]},{"id":"c52a8d10191c610a","type":"inject","z":"8df064aa6876a7dd","name":"flush A","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"flush","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"A","payloadType":"date","x":230,"y":260,"wires":[["23bd36c10fb74e21"]]},{"id":"23bd36c10fb74e21","type":"switch","z":"8df064aa6876a7dd","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"A","vt":"str"},{"t":"eq","v":"B","vt":"str"},{"t":"eq","v":"C","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":490,"y":240,"wires":[["7e94e34ce121c251"],["82a313a9e294c98a"],["1bac31a3717d45f3"]]},{"id":"82a313a9e294c98a","type":"delay","z":"8df064aa6876a7dd","name":"queue B","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":720,"y":240,"wires":[["3245e1f09c733145"]]},{"id":"7dcb3c82da72efaf","type":"inject","z":"8df064aa6876a7dd","name":"flush B","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"flush","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"B","payloadType":"date","x":230,"y":300,"wires":[["23bd36c10fb74e21"]]},{"id":"3245e1f09c733145","type":"debug","z":"8df064aa6876a7dd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":240,"wires":[]},{"id":"1bac31a3717d45f3","type":"delay","z":"8df064aa6876a7dd","name":"queue C","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":720,"y":300,"wires":[["3245e1f09c733145"]]},{"id":"b4327add7c20cb81","type":"inject","z":"8df064aa6876a7dd","name":"flush C","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"flush","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"C","payloadType":"date","x":230,"y":340,"wires":[["23bd36c10fb74e21"]]},{"id":"633ab4416171357b","type":"inject","z":"8df064aa6876a7dd","name":"input C","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"C","payloadType":"date","x":230,"y":220,"wires":[["23bd36c10fb74e21"]]}]

```

What happens if you run into a timeout? Have you checked out the q-gate node (node-red-contrib-queue-gate)?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [7 August 2021 21:36 UTC](https://discourse.nodered.org/t/flush-delay-node-by-topic/49441/5 "2021-08-07T21:36:28Z")

</div>

Certainly an idea worth thinking about

---

<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:** [6 October 2021 21:37 UTC](https://discourse.nodered.org/t/flush-delay-node-by-topic/49441/6 "2021-10-06T21:37:15Z")

</div>

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