# Force One Message at a Time?

**URL:** <https://discourse.nodered.org/t/force-one-message-at-a-time/62859>\
**Category:** General\
**Created:** [19 May 2022 18:02 UTC](https://discourse.nodered.org/t/force-one-message-at-a-time/62859 "2022-05-19T18:02:28Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [19 May 2022 21:25 UTC](https://discourse.nodered.org/t/force-one-message-at-a-time/62859/3 "2022-05-19T21:25:52Z")

</div>

Hello, and welcome to node-red!

Take a look at the brilliantly simple [node-red-contrib-semaphore](https://flows.nodered.org/node/node-red-contrib-semaphore)

It's just a pair of nodes that lets your flow `take` a "ticket" from a configurable pool of tickets _(in your case it's just the 1)_, and some time later your flow can "leave" that ticket, which immediately makes it available for the next msg in line to take it. Every msg that reaches the `semaphore-take` node **after the pool is empty** gets queued up until a semaphore becomes available by another msg reaching the `semaphore-leave` node.

The only thing to watch for is that you never want to take a semaphore without later returning it -- or else your queued up msgs will never be released. Best practice is to put a `watch` node on any nodes between the semaphores, to catch exceptions (e.g. an `http-request` that fails).

I can probably dig up an example of a flow that limits how many msgs can be "in-flight", if you get stuck trying to set it up -- but it's pretty simple to use. Good luck!

---

_[View the full topic](https://discourse.nodered.org/t/force-one-message-at-a-time/62859)._
