# \[ANNOUNCE\] node-red-contrib-queue-gate

**URL:** <https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948>\
**Category:** Share Your Nodes\
**Created:** [13 October 2018 02:28 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948 "2018-10-13T02:28:16Z")\
**Posts on this page:** 20\
**Page:** 1

<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:** [13 October 2018 02:28 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/1 "2018-10-13T02:28:16Z")

</div>

A new node, `node-red-contrib-queue-gate`, has been uploaded to npm. This is an enhanced version of `node-red-contrib-simple-gate` that additionally allows messages to be queued and released at a later time. See the discussion at [Gate node using Blockly](https://discourse.nodered.org/t/gate-node-using-blockly/2830/10).

From the help text:  
The node will transmit the input message to its output when in the `open` state and block it when `closed`. In the `queueing` state, the input message is added to the end of the message queue, provided space is available. The user can limit the size of the queue to prevent memory problems. Messages in the queue can be released (in the order received) either singly or the entire queue at once.

Messages with the user-defined topic `Control Topic` (set when the node is deployed) are not passed through but are used to control the state of the gate or the queue.

Control messages can have values representing commands that change the state of the gate: `open`, `close`, `toggle`, `queue`, or `default`. Messages that control the queue are `trigger`, `flush` and `purge`. The (case-insensitive) strings representing these commands are set by the user when the node is deployed. If a control message is received but not recognized, there is no output or change of state, and the node reports an error.

When first deployed or after a `default` command, the gate is in the user-selected state defined by `Default State`.

The node can be downloaded from npm, GitHub, or the palette manager.

---

<div class="post-metadata">

**Author:** ![tilleul](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tilleul/32/78_2.png) [@tilleul](https://discourse.nodered.org/u/tilleul)\
**Post date:** [13 October 2018 06:09 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/2 "2018-10-13T06:09:16Z")

</div>

this sounds very thorough ! 👍

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [13 October 2018 08:53 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/3 "2018-10-13T08:53:25Z")

</div>

It would be helpful if you could add your git repo URL to the 'repository' field name in your `package.json` file, so users can see in more detail how the node works.

---

<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:** [13 October 2018 17:58 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/4 "2018-10-13T17:58:56Z")

</div>

> [@Paul-Reed](#):
>
> add your git repo URL to the 'repository' field name in your `package.json` file

I realized there was a problem but didn't know how to solve it. Thanks for the help. This is my first go at using GitHub and npm, so there are bound to be glitches. Please keep pointing them out.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [13 October 2018 19:06 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/5 "2018-10-13T19:06:30Z")

</div>

Giving this a try out in queue mode - all well so far

Minor feedback - the node is labelled q gate but help text says q-gate - pick one and stick with it 🙂

Also flush and purge are too similar in meaning - maybe change flush to something like release?

---

<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:** [13 October 2018 19:54 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/6 "2018-10-13T19:54:11Z")

</div>

(For the delay node we use reset and flush)

---

<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:** [13 October 2018 19:56 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/7 "2018-10-13T19:56:37Z")

</div>

> [@cymplecy](#):
>
> Minor feedback - the node is labelled q gate but help text says q-gate - pick one and stick with it 🙂

Good catch. It's supposed to have the hyphen. I'll fix it.

---

<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:** [13 October 2018 19:59 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/8 "2018-10-13T19:59:42Z")

</div>

> [@dceejay](#):
>
> (For the delay node we use reset and flush)

I'm with @dceejay on this. "Flush" is pretty standard for mail and other other queues. "Delete" sounds a bit strong, so "reset" works for me. It will be a couple of days before I can update.

---

<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:** [13 October 2018 20:19 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/10 "2018-10-13T20:19:46Z")

</div>

> [@cymplecy](#):
>
> Minor feedback - the node is labelled q gate but help text says q-gate - pick one and stick with it 🙂

Strange. I'm not finding any problem in the html file. Is it possible that the editor is doing something to the name, perhaps the way it strips out -in and -out from node names?

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [13 October 2018 20:22 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/11 "2018-10-13T20:22:31Z")

</div>

OK - flush and reset 🙂

---

<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:** [6 November 2018 19:25 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/12 "2018-11-06T19:25:40Z")

</div>

> [@cymplecy](#):
>
> Minor feedback - the node is labelled q gate but help text says q-gate - pick one and stick with it 🙂

This oddity will be resolved in version 1.0.1 by adding  
`paletteLabel: "q–gate"`  
to the html file. HOWEVER, the character in this `palletLabel` that appears to be a hyphen is actually Unicode U+2013 (en dash) not Unicode: U+002D (hyphen-minus). Using U+002D in `palletLabel` also causes the hyphen to disappear in the palette, tending to confirm my suspicion that the editor is responsible.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [29 July 2019 10:22 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/13 "2019-07-29T10:22:19Z")

</div>

I want to use this in a flow but having trouble getting it to queue.

Should it default to automatically queuing messages when closed and then let them all through when the gate is opened?

This isn't working for me

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

```auto
[{"id":"43e9ec54.e1dfd4","type":"debug","z":"4fc7465b.4a9d28","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1200,"y":720,"wires":[]},{"id":"3c9e2a90.0dada6","type":"q-gate","z":"4fc7465b.4a9d28","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","maxQueueLength":"100","keepNewest":false,"x":1010,"y":720,"wires":[["43e9ec54.e1dfd4"]]},{"id":"d774a5f7.d20b38","type":"inject","z":"4fc7465b.4a9d28","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":800,"y":720,"wires":[["3c9e2a90.0dada6"]]},{"id":"d7a7ba22.030d78","type":"inject","z":"4fc7465b.4a9d28","name":"","topic":"control","payload":"toggle","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":810,"y":760,"wires":[["3c9e2a90.0dada6"]]}]

```

---

<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:** [29 July 2019 11:25 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/14 "2019-07-29T11:25:56Z")

</div>

To quote from teh info tab for the node  
"Transmits the input message when in the `open` state, blocks it when `closed` , and adds it to the message queue when in the `queueing` state".  
You are toggling between Open and Closed. I think you want to switch between Open and Queuing rather than Closed (which discards messages).

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [29 July 2019 11:34 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/15 "2019-07-29T11:34:36Z")

</div>

Well that what seems to be happening 🙂

And its what the simple gate node does

I'm sure I did mange to do this in the past but how to do it now is eluding me

---

<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:** [29 July 2019 13:05 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/16 "2019-07-29T13:05:10Z")

</div>

The toggle switches between open and closed, you need to switch between open and queuing, as described in the info tab.

```auto
[{"id":"2d8fd1e0.23158e","type":"debug","z":"514a90a5.c7bae8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":524,"y":538,"wires":[]},{"id":"44dbf6d3.4edfe","type":"q-gate","z":"514a90a5.c7bae8","name":"","controlTopic":"control","defaultState":"queueing","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","maxQueueLength":"100","keepNewest":false,"x":350,"y":538,"wires":[["2d8fd1e0.23158e"]]},{"id":"c76cf295.0ed428","type":"inject","z":"514a90a5.c7bae8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":538,"wires":[["44dbf6d3.4edfe"]]},{"id":"a7ca71cf.4d60a","type":"inject","z":"514a90a5.c7bae8","name":"","topic":"control","payload":"queue","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":578,"wires":[["44dbf6d3.4edfe"]]},{"id":"d940a95b.428c","type":"inject","z":"514a90a5.c7bae8","name":"","topic":"control","payload":"open","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":149,"y":623,"wires":[["44dbf6d3.4edfe"]]}]

```

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [29 July 2019 13:11 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/17 "2019-07-29T13:11:51Z")

</div>

Got you now - ta

---

<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:** [29 July 2019 16:45 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/18 "2019-07-29T16:45:27Z")

</div>

I'm glad this is sorted. Currently, the only `toggle` command available switches back and forth between `open` and `closed` states. At one time, I considered toggle commands involving the `queueing` state, but gave up the idea. The node could handle it internally, but the control message structure and user interface quickly became too fussy. Given a clear requirement, I could be convinced to take another look.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [29 July 2019 17:21 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/19 "2019-07-29T17:21:25Z")

</div>

I'm thinking simple selection in the config - do want toggle to select between open/closed or open/queued

---

<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:** [29 July 2019 17:57 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/20 "2019-07-29T17:57:41Z")

</div>

> [@cymplecy](#):
>
> simple selection in the config

Got it. I will take another look. Please raise an issue on GitHub, so we can continue the discussion there. I'm leaving tomorrow on a two-week holiday, so you probably won't see much from me soon, except perhaps the sketch of a proposal. Please consider whether when the gate switches from `queueing` to `closed` the queue should be flushed (all messages forwarded at once) or reset (all messages deleted).

---

<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:** [29 July 2019 19:36 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948/21 "2019-07-29T19:36:50Z")

</div>

(Jumping in) I would say reset/dropped. If you want to deliver them you could go. Queued - open - closed

[Next page](https://discourse.nodered.org/t/announce-node-red-contrib-queue-gate/3948.md?page=2)
