-
Notifications
You must be signed in to change notification settings - Fork 6
/
simple-message-queue.html
68 lines (65 loc) · 4.58 KB
/
simple-message-queue.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!--
A simpe messages queue for IBM's Node-Red
https://github.com/shady2k/node-red-contrib-simple-message-queue
(c) 2017, shady2k <shady2k@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/javascript">
RED.nodes.registerType('simple-queue', {
icon: "simple-message-queue.svg",
category: 'storage',
color: '#ff9900',
defaults: {
name: { value: "" },
firstMessageBypass: { value: true },
bypassInterval: { value: "0", validate: RED.validators.regex(/^\+?(0|[1-9]\d*)$/) },
},
inputs: 1,
outputs: 1,
label: function () {
return (this.name || "simple queue");
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
}
});
</script>
<script type="text/html" data-template-name="simple-queue">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"/>
</div>
<div class="form-row">
<input type="checkbox" id="node-input-firstMessageBypass" style="display:inline-block; width:auto; vertical-align:top;" />
<label for="node-input-firstMessageBypass" style="width:70%;"></i> Bypass first message?</label>
</div>
<div class="form-row">
<label for="node-input-bypassInterval" style="width:70%;"><i class="fa fa-clock-o"></i> Bypass interval (milliseconds):</label>
<input type="text" id="node-input-bypassInterval" placeholder="Bypass interval"/>
</div>
</script>
<script type="text/html" data-help-name="simple-queue">
<p>
Use this node to store incoming messages in memory queue. Use a feedback from a following action or message with trigger property to release the next message.
<br/><br/>
<h3>Inputs</h3><br/>
<b>trigger</b>: If a message is received with this property, one message from the queue will be released. The outbound message will have a _queueCount property with number of messages left in the queue. _queueCount will not include the message triggered. For example, if the message triggered is the last one in the queue, _queueCount will be 0 (zero).<br/>
<b>reset</b>: If a message is received with the reset property, all messages in the queue will be cleared. In addition, the node will not forward the incoming reset message for processing by any subsequent nodes in the sequence.<br/>
<b>ttl</b>: If a message is received with this property, a message will be added to the queue and will live in the queue for specific value in milliseconds. The value of the TTL must be a non-negative integer (0 <= n), describing the TTL period in milliseconds. Thus a value of 1000 means that a message added to the queue will live in the queue for 1 second. If message with TTL property has not been released for specified time, it will be deleted from queue without any output.</br>
<b>queueCount</b>: If a message is received with this property, node will send message with number of messages left in the queue in _queueCount property. This message won't store in queue.<br/>
<b>bypass</b>: If a message is received with this property, and it set to true, bypass mode will turned on and all new incoming messages will be bypassed to output with _queueCount property, messaged in queue will not be cleared. If bypass property set to false, bypass mode will turned off and node return to normal operational, queue will not be cleared. Message with bypass property won't store in queue and trigger any messages.</br>
<b>bypassInterval</b>: Message with this property allow to dynamically change bypass interval in milliseconds from config, 0 - no bypass.</br>
<br/>
<h3>Config</h3><br/>
<b>Bypass first message?</b>: If this flag set to True, first new message will be bypassed, than node will be busy until it's not get message with trigger property. True by default.<br/>
<b>Bypass interval</b>: If this value greater than 0, node will realease message from queue without trigger after specific interval in milliseconds since last message send.<br/>
</p>
</script>