Allow only the first message to pass from a burst

I needed to have only the first message from a burst of messages, for example in an RSS or email recollection were many messages are created, this flow lets only the first one to reach the target.

There are maybe better ways to do this, I've been unable to find them.

[{"id":"9a9d81c9ce8d3d49","type":"group","z":"e8c5f729a17793a1","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["8fb5c5ef63bb2a92","5951891e7061b9c6","81da6c6fb216348e","1f2f431e3da6bf76","1b9b2cf9ad7af168","fe78f31803b143fa","f48b8519d8ea03c0"],"x":134,"y":119,"w":702,"h":182},{"id":"8fb5c5ef63bb2a92","type":"q-gate","z":"e8c5f729a17793a1","g":"9a9d81c9ce8d3d49","name":"","controlTopic":"control","defaultState":"queueing","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","peekCmd":"peek","dropCmd":"drop","statusCmd":"status","maxQueueLength":"1","keepNewest":false,"qToggle":false,"persist":false,"storeName":"memory","x":690,"y":200,"wires":[["1b9b2cf9ad7af168"]]},{"id":"5951891e7061b9c6","type":"delay","z":"e8c5f729a17793a1","g":"9a9d81c9ce8d3d49","name":"","pauseType":"delay","timeout":"300","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":370,"y":260,"wires":[["81da6c6fb216348e"]]},{"id":"81da6c6fb216348e","type":"change","z":"e8c5f729a17793a1","g":"9a9d81c9ce8d3d49","name":"flush","rules":[{"t":"set","p":"payload","pt":"msg","to":"flush","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":260,"wires":[["8fb5c5ef63bb2a92"]]},{"id":"1f2f431e3da6bf76","type":"link in","z":"e8c5f729a17793a1","g":"9a9d81c9ce8d3d49","name":"get first message","links":[],"x":175,"y":200,"wires":[["f48b8519d8ea03c0"]]},{"id":"1b9b2cf9ad7af168","type":"link out","z":"e8c5f729a17793a1","g":"9a9d81c9ce8d3d49","name":"get first out","mode":"return","links":[],"x":795,"y":200,"wires":[]},{"id":"fe78f31803b143fa","type":"comment","z":"e8c5f729a17793a1","g":"9a9d81c9ce8d3d49","name":"Dejar pasar el primer mensaje de un burst","info":"","x":440,"y":160,"wires":[]},{"id":"f48b8519d8ea03c0","type":"junction","z":"e8c5f729a17793a1","g":"9a9d81c9ce8d3d49","x":220,"y":200,"wires":[["8fb5c5ef63bb2a92","5951891e7061b9c6"]]}]

Flow Info

Created 2 years, 5 months ago
Rating:

Owner

Actions

Rate:

Node Types

Core
  • change (x1)
  • comment (x1)
  • delay (x1)
  • link in (x1)
  • link out (x1)
Other
  • group (x1)
  • junction (x1)
  • q-gate (x1)

Tags

  • queue
  • first
  • message
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option