@redkern/node-red-redis 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +188 -0
  3. package/README.md +283 -2
  4. package/SECURITY.md +11 -0
  5. package/examples/commands-and-pubsub.json +15 -0
  6. package/examples/streams-at-least-once.json +23 -0
  7. package/lib/completion.js +79 -0
  8. package/lib/control.js +59 -0
  9. package/lib/denylist.js +118 -0
  10. package/lib/dlq.js +49 -0
  11. package/lib/format.js +122 -0
  12. package/lib/inflight.js +131 -0
  13. package/lib/list-consumer.js +125 -0
  14. package/lib/metrics.js +85 -0
  15. package/lib/node-helpers.js +77 -0
  16. package/lib/palette.js +168 -0
  17. package/lib/slot.js +33 -0
  18. package/lib/stream-consumer.js +669 -0
  19. package/nodes/icons/redkern-redis-command.svg +4 -0
  20. package/nodes/icons/redkern-redis-list-in.svg +4 -0
  21. package/nodes/icons/redkern-redis-multi.svg +4 -0
  22. package/nodes/icons/redkern-redis-scan.svg +4 -0
  23. package/nodes/icons/redkern-redis-stream-ack.svg +4 -0
  24. package/nodes/icons/redkern-redis-stream-claim.svg +4 -0
  25. package/nodes/icons/redkern-redis-stream-control.svg +4 -0
  26. package/nodes/icons/redkern-redis-stream-gc.svg +4 -0
  27. package/nodes/icons/redkern-redis-stream-in.svg +4 -0
  28. package/nodes/icons/redkern-redis-stream-metrics.svg +4 -0
  29. package/nodes/icons/redkern-redis-stream-out.svg +4 -0
  30. package/nodes/icons/redkern-redis-subscribe.svg +4 -0
  31. package/nodes/icons/redkern-redis.svg +4 -0
  32. package/nodes/locales/en-US/redkern-redis.html +299 -0
  33. package/nodes/locales/en-US/redkern-redis.json +308 -0
  34. package/nodes/redkern-redis-command.js +49 -0
  35. package/nodes/redkern-redis-config.js +273 -0
  36. package/nodes/redkern-redis-list-in.js +88 -0
  37. package/nodes/redkern-redis-multi.js +75 -0
  38. package/nodes/redkern-redis-scan.js +105 -0
  39. package/nodes/redkern-redis-stream-ack.js +66 -0
  40. package/nodes/redkern-redis-stream-claim.js +60 -0
  41. package/nodes/redkern-redis-stream-control.js +35 -0
  42. package/nodes/redkern-redis-stream-gc.js +77 -0
  43. package/nodes/redkern-redis-stream-in.js +155 -0
  44. package/nodes/redkern-redis-stream-metrics.js +85 -0
  45. package/nodes/redkern-redis-stream-out.js +55 -0
  46. package/nodes/redkern-redis-subscribe.js +51 -0
  47. package/nodes/redkern-redis.html +1126 -0
  48. package/nodes/redkern-redis.js +31 -0
  49. package/package.json +76 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 - 2026-11-21
4
+
5
+ First production release of the palette that replaces `@yroshcha/node-red-contrib-redis-full`. Covers the full scope of the spec (alpha.1 to rc.1); the acceptance criteria of section 9, including the load tests, pass on Node.js 22 and 24 with Node-RED 4.1 and 5.
6
+
7
+ - Config node on `@redkern/node-red-kit` `createRedisClient` with shared, blocking and subscriber roles, no offline queue, `${VAR}` fields and password credentials (RDS-CON-1..6).
8
+ - command with `allowMsgCommand` off by default, a default denylist and rejection of blocking commands; multi, scan with limit, timeout and all cluster masters; Pub/Sub-only subscribe; transitional list-in with prefetch (RDS-CMD-1..8).
9
+ - stream-in with cursor-based PEL recovery, a palette-level in-flight registry, one range `XPENDING` per batch, atomic DLQ moves, per-consumer or group backpressure, `XAUTOCLAIM` with a persistent cursor, batching, rate limit and start paused (RDS-STR-1..11).
10
+ - stream-out, stream-ack with batch ACK and legacy fields, stream-claim, stream-gc with an atomic empty-PEL check, stream-metrics with a palette metrics registry (RDS-STR-12..15).
11
+ - pause/resume/drain/status through stream-control, the admin API with permissions and a loopback drain route on port 9551 for preStop (RDS-CTL-1..5).
12
+ - Editor look per the kit standard: coral colour, disc-stack motif with an action sign per node, message catalogs, help, tabs for config and stream-in (RDS-UI-1).
13
+ - Manual migration guide from `@yroshcha/node-red-contrib-redis-full` in the README: type mapping and what to set by hand (RDS-MIG-1).
14
+ - One node set `redkern-redis` with a single palette closure per kit KIT-ARCH-2; editor sources in `editor/`, generated `nodes/redkern-redis.html` and one message catalog.
15
+ - Settings read as `redkernRedisConfig<Key>` (KIT-CFG-6); admin errors through kit `PublicError`; a wrong password shows a red auth status instead of endless retries.
16
+ - Recovery walks the own PEL with XPENDING and claims back only entries not in flight with XCLAIM, so redeploys no longer raise delivery counts and cannot send an in-flight entry to the DLQ (D1); an entry acknowledged during recovery is not sent again.
17
+ - drain sends entries returned by a read that was blocked when drain started and recovers the own PEL before waiting; admin drain no longer times out after 10 s.
18
+ - The denylist also covers SWAPDB, FAILOVER, SAVE, FUNCTION FLUSH, CLIENT KILL/PAUSE and CLUSTER admin subcommands; scripts are rejected from msg.command and msg.commands; commands that change the shared connection (CLIENT REPLY, HELLO, AUTH, READONLY) are always rejected.
19
+ - Pre-indexed default denylist entries avoid reparsing the entire list for every command.
20
+ - list in returns an element popped while the node closes to the list; backpressure reconcile keeps newer in-flight IDs; NOPERM and WRONGTYPE give a red status.
21
+ - Requires `@redkern/node-red-kit` 1.3.0 or later within major version 1. Its internal listener is loopback-only or token-only (KIT-HTTP-6): with `REDKERN_REDIS_METRICS_TOKEN` the drain route needs `REDKERN_REDIS_DRAIN_TOKEN`, otherwise it is off with a warning. Admin routes answer 503 `ADMIN_AUTH_REQUIRED` without `adminAuth`.
22
+ - TLS always verifies the server certificate; a rejected certificate gives a red auth status.
23
+ - The streams example also shows stream-claim, so every node has an example (Flow Library check N02).
24
+ - Lint for forbidden patterns, requirement ID check against `docs/spec.md`, network fault tests through a TCP proxy, cluster, TLS, TLS cluster, fuzz and ACL tests, acceptance load tests, a cluster chaos test (failover, master kill, slot migration), a multi-pod test (SIGKILL, preStop drain, SIGTERM) and a soak test with redeploys.
package/LICENSE ADDED
@@ -0,0 +1,188 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the
13
+ copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other
16
+ entities that control, are controlled by, or are under common control with
17
+ that entity. For the purposes of this definition, "control" means (i) the
18
+ power, direct or indirect, to cause the direction or management of such
19
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent
20
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of
21
+ such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation source, and
28
+ configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical transformation
31
+ or translation of a Source form, including but not limited to compiled object
32
+ code, generated documentation, and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object form,
35
+ made available under the License, as indicated by a copyright notice that is
36
+ included in or attached to the work (an example is provided in the Appendix
37
+ below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object form,
40
+ that is based on (or derived from) the Work and for which the editorial
41
+ revisions, annotations, elaborations, or other modifications represent, as a
42
+ whole, an original work of authorship. For the purposes of this License,
43
+ Derivative Works shall not include works that remain separable from, or
44
+ merely link (or bind by name) to the interfaces of, the Work and Derivative
45
+ Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including the original
48
+ version of the Work and any modifications or additions to that Work or
49
+ Derivative Works thereof, that is intentionally submitted to Licensor for
50
+ inclusion in the Work by the copyright owner or by an individual or Legal
51
+ Entity authorized to submit on behalf of the copyright owner. For the
52
+ purposes of this definition, "submitted" means any form of electronic,
53
+ verbal, or written communication sent to the Licensor or its representatives,
54
+ including but not limited to communication on electronic mailing lists,
55
+ source code control systems, and issue tracking systems that are managed by,
56
+ or on behalf of, the Licensor for the purpose of discussing and improving the
57
+ Work, but excluding communication that is conspicuously marked or otherwise
58
+ designated in writing by the copyright owner as "Not a Contribution."
59
+
60
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
61
+ behalf of whom a Contribution has been received by Licensor and subsequently
62
+ incorporated within the Work.
63
+
64
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
65
+ License, each Contributor hereby grants to You a perpetual, worldwide,
66
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
67
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
68
+ sublicense, and distribute the Work and such Derivative Works in Source or
69
+ Object form.
70
+
71
+ 3. Grant of Patent License. Subject to the terms and conditions of this
72
+ License, each Contributor hereby grants to You a perpetual, worldwide,
73
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
74
+ section) patent license to make, have made, use, offer to sell, sell, import,
75
+ and otherwise transfer the Work, where such license applies only to those
76
+ patent claims licensable by such Contributor that are necessarily infringed
77
+ by their Contribution(s) alone or by combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You institute
79
+ patent litigation against any entity (including a cross-claim or counterclaim
80
+ in a lawsuit) alleging that the Work or a Contribution incorporated within
81
+ the Work constitutes direct or contributory patent infringement, then any
82
+ patent licenses granted to You under this License for that Work shall
83
+ terminate as of the date such litigation is filed.
84
+
85
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
86
+ Derivative Works thereof in any medium, with or without modifications, and
87
+ in Source or Object form, provided that You meet the following conditions:
88
+
89
+ (a) You must give any other recipients of the Work or Derivative Works a copy
90
+ of this License; and
91
+
92
+ (b) You must cause any modified files to carry prominent notices stating
93
+ that You changed the files; and
94
+
95
+ (c) You must retain, in the Source form of any Derivative Works that You
96
+ distribute, all copyright, patent, trademark, and attribution notices
97
+ from the Source form of the Work, excluding those notices that do not
98
+ pertain to any part of the Derivative Works; and
99
+
100
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
101
+ then any Derivative Works that You distribute must include a readable
102
+ copy of the attribution notices contained within such NOTICE file,
103
+ excluding those notices that do not pertain to any part of the
104
+ Derivative Works, in at least one of the following places: within a
105
+ NOTICE text file distributed as part of the Derivative Works; within the
106
+ Source form or documentation, if provided along with the Derivative
107
+ Works; or, within a display generated by the Derivative Works, if and
108
+ wherever such third-party notices normally appear. The contents of the
109
+ NOTICE file are for informational purposes only and do not modify the
110
+ License. You may add Your own attribution notices within Derivative
111
+ Works that You distribute, alongside or as an addendum to the NOTICE text
112
+ from the Work, provided that such additional attribution notices cannot
113
+ be construed as modifying the License.
114
+
115
+ You may add Your own copyright statement to Your modifications and may
116
+ provide additional or different license terms and conditions for use,
117
+ reproduction, or distribution of Your modifications, or for any such
118
+ Derivative Works as a whole, provided Your use, reproduction, and
119
+ distribution of the Work otherwise complies with the conditions stated in
120
+ this License.
121
+
122
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
123
+ Contribution intentionally submitted for inclusion in the Work by You to the
124
+ Licensor shall be under the terms and conditions of this License, without
125
+ any additional terms or conditions. Notwithstanding the above, nothing herein
126
+ shall supersede or modify the terms of any separate license agreement you
127
+ may have executed with Licensor regarding such Contributions.
128
+
129
+ 6. Trademarks. This License does not grant permission to use the trade names,
130
+ trademarks, service marks, or product names of the Licensor, except as
131
+ required for reasonable and customary use in describing the origin of the
132
+ Work and reproducing the content of the NOTICE file.
133
+
134
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
135
+ writing, Licensor provides the Work (and each Contributor provides its
136
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
137
+ KIND, either express or implied, including, without limitation, any
138
+ warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
139
+ FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining
140
+ the appropriateness of using or redistributing the Work and assume any risks
141
+ associated with Your exercise of permissions under this License.
142
+
143
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
144
+ tort (including negligence), contract, or otherwise, unless required by
145
+ applicable law (such as deliberate and grossly negligent acts) or agreed to
146
+ in writing, shall any Contributor be liable to You for damages, including
147
+ any direct, indirect, special, incidental, or consequential damages of any
148
+ character arising as a result of this License or out of the use or inability
149
+ to use the Work (including but not limited to damages for loss of goodwill,
150
+ work stoppage, computer failure or malfunction, or any and all other
151
+ commercial damages or losses), even if such Contributor has been advised of
152
+ the possibility of such damages.
153
+
154
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
155
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
156
+ acceptance of support, warranty, indemnity, or other liability obligations
157
+ and/or rights consistent with this License. However, in accepting such
158
+ obligations, You may act only on Your own behalf and on Your sole
159
+ responsibility, not on behalf of any other Contributor, and only if You agree
160
+ to indemnify, defend, and hold each Contributor harmless for any liability
161
+ incurred by, or claims asserted against, such Contributor by reason of your
162
+ accepting any such warranty or additional liability.
163
+
164
+ END OF TERMS AND CONDITIONS
165
+
166
+ APPENDIX: How to apply the Apache License to your work.
167
+
168
+ To apply the Apache License to your work, attach the following boilerplate
169
+ notice, with the fields enclosed by brackets "[]" replaced with your own
170
+ identifying information. (Don't include the brackets!) The text should be
171
+ enclosed in the appropriate comment syntax for the file format. We also
172
+ recommend that a file or class name and description of purpose be included on
173
+ the same "printed page" as the copyright notice for easier identification
174
+ within third-party archives.
175
+
176
+ Copyright [yyyy] [name of copyright owner]
177
+
178
+ Licensed under the Apache License, Version 2.0 (the "License");
179
+ you may not use this file except in compliance with the License.
180
+ You may obtain a copy of the License at
181
+
182
+ http://www.apache.org/licenses/LICENSE-2.0
183
+
184
+ Unless required by applicable law or agreed to in writing, software
185
+ distributed under the License is distributed on an "AS IS" BASIS,
186
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
187
+ See the License for the specific language governing permissions and
188
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,284 @@
1
- # Temporary Holding Version
1
+ # @redkern/node-red-redis
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Production Redis palette for Node-RED: arbitrary commands, transactions, scans, Pub/Sub, a transitional list queue and Redis Streams consumer groups with at-least-once delivery, a dead-letter stream, backpressure and Kubernetes rollout control. Part of the [redkern](https://github.com/redkern) palette family, built on [`@redkern/node-red-kit`](https://www.npmjs.com/package/@redkern/node-red-kit). Replaces `@yroshcha/node-red-contrib-redis-full`.
4
+
5
+ ![Nodes of the palette in the example flows](https://raw.githubusercontent.com/redkern/node-red-redis/main/docs/nodes.png)
6
+
7
+ ## Requirements
8
+
9
+ - Node.js 22 or newer
10
+ - Node-RED 4.1 or 5.x
11
+ - Redis 6.2 or newer, or Valkey 7.2 or newer (Redis 7 recommended: `XAUTOCLAIM` reports deleted entries). Tested locally on Redis 7.0 and 8.0 and Valkey 7.2 and 8.1; CI also runs Redis 6.2.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ npm install @redkern/node-red-redis
17
+ ```
18
+
19
+ The package registers 13 node types in the **redkern redis** category . It installs side by side with `@yroshcha/node-red-contrib-redis-full`: types, routes and settings do not overlap.
20
+
21
+ ## Nodes
22
+
23
+ | Node | Type | What it does |
24
+ | --- | --- | --- |
25
+ | redis (config) | `redkern-redis-config` | Standalone or Cluster connection, shared by the nodes that use it |
26
+ | [command](#command) | `redkern-redis-command` | One command on the shared connection, with denylist |
27
+ | [multi](#multi) | `redkern-redis-multi` | MULTI/EXEC transaction |
28
+ | [scan](#scan) | `redkern-redis-scan` | Full SCAN/HSCAN/SSCAN/ZSCAN walk with limit and timeout |
29
+ | [subscribe](#subscribe) | `redkern-redis-subscribe` | Pub/Sub channels and patterns |
30
+ | [list in](#list-in) | `redkern-redis-list-in` | BLPOP/BRPOP intake for list queues (transitional) |
31
+ | [stream in](#stream-in) | `redkern-redis-stream-in` | Consumer group reader, at-least-once |
32
+ | [stream out](#stream-out) | `redkern-redis-stream-out` | XADD |
33
+ | [stream ack](#stream-ack) | `redkern-redis-stream-ack` | XACK, single or batch |
34
+ | [stream claim](#stream-claim) | `redkern-redis-stream-claim` | Manual XAUTOCLAIM |
35
+ | [stream gc](#stream-gc) | `redkern-redis-stream-gc` | Removes idle consumers with an empty PEL |
36
+ | [stream metrics](#metrics) | `redkern-redis-stream-metrics` | Group sample: PEL, lag, consumers, DLQ length |
37
+ | [stream control](#control) | `redkern-redis-stream-control` | pause, resume, drain, status of stream in nodes |
38
+
39
+ Examples are in [`examples/`](examples) and appear in the Node-RED import menu.
40
+
41
+ ## Message contract
42
+
43
+ Every node writes its metadata only under `msg.redkern.redis` and never replaces `msg.redkern` or another palette's key, so a kafka → redis flow keeps both `msg.redkern.kafka` and `msg.redkern.redis`.
44
+
45
+ stream in sends:
46
+
47
+ ```js
48
+ msg.payload // entry fields; JSON objects and arrays written by stream out are restored
49
+ msg.redkern.redis = { stream, group, id, consumer, deliveries }
50
+ // with batching: payload, id and deliveries are arrays of the same length
51
+ ```
52
+
53
+ `legacyMsgFields` additionally sets the fields of the legacy palette (`msg.streamId`, `msg.stream`, `msg.group`, `msg._streamKey`, `msg._streamGroup`, `msg.consumer`, and `msg.scanComplete`, `msg.acked` on the other nodes). Turn it on for a migrated node when the flow still reads those fields; new nodes keep it off.
54
+
55
+ ## <a id="config"></a>Connection
56
+
57
+ Host, port, username and timeouts are set in the config node in the flow. When a value has to come from the environment, write `${VAR}` in the field: Node-RED resolves it, the flow in Git still shows where the value comes from, and two config nodes can point at different Redis servers. An unresolved `${VAR}` stops the node with `ENV_UNRESOLVED`. The password is a credential.
58
+
59
+ Connections per pod:
60
+
61
+ ```
62
+ connections = configs × 1 (shared)
63
+ + configs with subscribe nodes × 1 (subscriber)
64
+ + stream in nodes + list in nodes (blocking, one each)
65
+ ```
66
+
67
+ The live numbers are in the config dialog (Reliability tab, needs `adminAuth`) and in `redkern_redis_connections{role}`. While the legacy and the new palette run side by side during migration, each has its own config nodes, so the count doubles: check `maxclients` before you start.
68
+
69
+ TLS always verifies the server certificate against the system CAs; there is no option to turn verification off. A private CA is added to the Node.js process with `NODE_EXTRA_CA_CERTS`. When the certificate is issued for a name other than the host you connect to (for example an IP or a NAT address), set **TLS server name**. A rejected certificate gives a red status with the TLS error code instead of endless retries. In cluster mode the certificate of every node is checked against the address the cluster announces, so it must carry that hostname or IP; this is the case for AWS ElastiCache and MemoryDB.
70
+
71
+ Cluster mode uses database 0. A stream and its DLQ must share a hash tag, for example `orders:{eu}` and `orders:{eu}:dlq`; otherwise stream in stops on start with `DLQ_CROSS_SLOT`.
72
+
73
+ ### <a id="acl"></a>Redis ACL
74
+
75
+ Tested minimal ACL for the palette's own operations plus ordinary data commands of command and multi (Redis 7, Valkey 7.2):
76
+
77
+ ```
78
+ ACL SETUSER node-red on >PASSWORD ~* &* +@read +@write +@stream +@list +@pubsub +@transaction +@connection +eval +evalsha -@dangerous +info
79
+ ```
80
+
81
+ - In cluster mode add `+cluster|slots +cluster|info`; ioredis needs them to discover the topology.
82
+ - `+info` is optional: without it ioredis skips its ready check and logs one warning per connection.
83
+ - With list in, add `+client|unblock` (it is in `@dangerous`): on close the node ends its own BLPOP at once, so an element popped at that moment is pushed back. Without it close waits up to 1.5 s for the pop.
84
+ - Narrow `~*` and `&*` to the key and channel prefixes of your flows. stream in also writes the DLQ (`<stream>:dlq` by default) and stream gc runs a Lua script through `EVAL`.
85
+ - The suite runs against both `+@all -@dangerous` and this list: `REDIS_USERNAME=... REDIS_PASSWORD=... npm run test:integration`.
86
+
87
+ ## <a id="command"></a>command, multi, scan
88
+
89
+ - command takes the command from the node (`HGET`, `XINFO STREAM`) and arguments from `msg.args`. `msg.command` (string or token array) is used only with **Allow msg.command**, which is off by default.
90
+ - The denylist rejects `FLUSHALL`, `FLUSHDB`, `CONFIG`, `SHUTDOWN`, `DEBUG`, `MODULE`, `ACL`, `REPLICAOF`, `SLAVEOF`, `MIGRATE` and `SCRIPT FLUSH`, and commands with the same blast radius: `SWAPDB`, `FAILOVER`, `SAVE`, `BGSAVE`, `BGREWRITEAOF`, `FUNCTION FLUSH/DELETE/RESTORE`, `CLIENT KILL/PAUSE/UNBLOCK` and the admin subcommands of `CLUSTER`. It applies inside multi too and is disabled only by an explicit checkbox.
91
+ - Scripts (`EVAL`, `EVALSHA`, `FCALL`, `FUNCTION`, `SCRIPT`) are rejected when the command comes from `msg.command` or `msg.commands`: `EVAL "return redis.call('FLUSHALL')" 0` would bypass the denylist. Set `EVAL` as the command of the node and pass the script and keys in `msg.args` instead.
92
+ - Blocking commands (`BLPOP`, `WAIT`, `XREADGROUP … BLOCK`, `SUBSCRIBE`…) and commands that change the shared connection (`CLIENT REPLY`, `CLIENT TRACKING`, `CLIENT SETNAME`, `HELLO`, `AUTH`, `READONLY`) are always rejected: one of them would stall or break every node on the config.
93
+ - The denylist is a guard against mistakes, not a security boundary. Give the palette a Redis ACL user with only what it needs (see [Redis ACL](#acl)).
94
+ - command, multi and stream out run up to **Concurrency** messages at once (default 64) with **Max queue** waiting (default 10 000); a full queue fails with `INPUT_QUEUE_FULL`, a message that waited more than 30 s for the connection fails with `NODE_NOT_READY`. With concurrency above 1 the order of results is not guaranteed; set 1 when order matters.
95
+ - **Send errors to a separate output** moves errors from Catch to an extra last output labelled `error`. Use it in high-rate flows, where a Redis outage would otherwise flood Loki.
96
+ - scan walks the cursor until the end, **Max results** or **Timeout (ms)**; in cluster mode SCAN visits every master. `msg.redkern.redis.scan` tells whether the result is complete.
97
+
98
+ ## <a id="subscribe"></a>subscribe
99
+
100
+ Pub/Sub only: SUBSCRIBE or PSUBSCRIBE. All subscribe nodes of one config node share one subscriber connection, and subscriptions are restored after a reconnect.
101
+
102
+ ## <a id="list-in"></a>list in
103
+
104
+ A transitional node for queues on lists, with the semantics of the legacy subscribe node in BLPOP/BRPOP mode: popping removes the element. It is deprecated as soon as the queues move to Streams; there is no reliable BLMOVE mode.
105
+
106
+ **Prefetch** limits elements in the flow at once. `1` (default) pops the next element only after the previous message completed in the flow (tracked through the Node-RED `onComplete` hook); `0` is unlimited, the legacy behaviour: set it on list in nodes that replace a legacy subscribe. A message that never completes frees its slot after **Release timeout**.
107
+
108
+ ## <a id="stream-in"></a>stream in: at-least-once
109
+
110
+ - The group is created with `MKSTREAM` on start and restored if it disappears (`NOGROUP`).
111
+ - **ACK manual** (default) keeps every entry in the PEL until stream ack. **ACK auto** acknowledges right after sending and is at-most-once.
112
+ - On start, after an error and after a lost reply the node reads its own PEL through a cursor: from `0`, then from the last ID received, until an empty reply, then switches to `>`. Entries the flow is still processing are kept in an in-flight registry and are not sent again, also across a redeploy of the node.
113
+ - After its own recovery the node reclaims entries of dead consumers with `XAUTOCLAIM` every **Reclaim interval**, keeping the cursor between calls.
114
+ - An entry delivered more than **Max deliveries** times moves to the DLQ (`<stream>:dlq` by default) with `XADD` and `XACK` in one `MULTI`. Delivery counts are read with one range `XPENDING` per batch. DLQ records keep the legacy fields: `sourceStream`, `sourceGroup`, `sourceId`, `consumer`, `deliveries`, `payload`.
115
+ - **Backpressure** stops reading when the PEL reaches **Max pending**: the own PEL of this consumer (default) or the PEL of the whole group.
116
+ - **Batch window**, **Read count**, **Rate limit** and **Read interval** keep the semantics of the legacy node.
117
+ - **Start paused** creates the group but reserves no work until resume, for Kubernetes rollouts.
118
+
119
+ ### Idempotency is required
120
+
121
+ At-least-once means an entry can arrive again:
122
+
123
+ - after a pod crash, when another pod reclaims it with `XAUTOCLAIM`;
124
+ - when processing one message takes longer than **Reclaim idle** (default 60 s), because another consumer may take the entry meanwhile.
125
+
126
+ Set **Reclaim idle** above the slowest processing time and make downstream processing idempotent, for example by keying side effects on `msg.redkern.redis.id`. `redkern_redis_redeliveries_total` counts repeated deliveries. Only pause/resume and a regular redeploy are free of duplicates.
127
+
128
+ The default consumer name is `<pod name>-<node id>` (`os.hostname()` in Kubernetes), the same as in the legacy palette, so consumer names do not change after migration. A custom **Consumer** must stay unique per pod (for example `${HOSTNAME}-orders`): with one fixed name for every HPA pod, each pod treats the others' in-flight entries as its own, resends them on recovery, and drain never sees an empty PEL.
129
+
130
+ ## <a id="stream-out"></a>stream out, <a id="stream-ack"></a>stream ack, <a id="stream-claim"></a>stream claim, <a id="stream-gc"></a>stream gc
131
+
132
+ - stream out writes a flat `msg.payload` object; nested values become JSON, as before. The new ID goes to `msg.redkern.redis.xadd`, leaving the entry metadata of stream in intact, so stream in → stream out → stream ack still acknowledges the original entry. `MAXLEN` needs the explicit **Allow trimming** option.
133
+ - stream ack takes `id` (string or array), `stream` and `group` from `msg.redkern.redis`, then from the legacy fields, then from its own configuration. A batch is acknowledged with one `XACK`. **XDEL after ACK** deletes after a successful ACK. By default the node has no output; **Pass the message on** adds one.
134
+ - stream claim runs `XAUTOCLAIM` on demand for manual recovery flows.
135
+ - stream gc deletes consumers idle longer than **Min idle** whose PEL is empty. The PEL check and `XGROUP DELCONSUMER` run in one Lua script. Automatic `XTRIM` is out of scope.
136
+
137
+ ## <a id="metrics"></a>Metrics
138
+
139
+ The palette keeps its own registry in Prometheus text 0.0.4 and announces it through kit while at least one stream metrics node exists:
140
+
141
+ - with `@redkern/node-red-prometheus` the metrics appear in its `/metrics`;
142
+ - without it they are served on the internal port: `GET http://<pod>:9551/redkern/redis/metrics` with `Authorization: Bearer $REDKERN_REDIS_METRICS_TOKEN`. Without the token this route does not exist.
143
+
144
+ | Metric | Type | Labels |
145
+ | --- | --- | --- |
146
+ | `redkern_redis_connections` | gauge | `role` |
147
+ | `redkern_redis_delivered_total` | counter | `stream`, `group` |
148
+ | `redkern_redis_redeliveries_total` | counter | `stream`, `group` |
149
+ | `redkern_redis_acked_total` | counter | `stream`, `group` |
150
+ | `redkern_redis_dead_letter_total` | counter | `stream`, `group` |
151
+ | `redkern_redis_consumer_paused`, `redkern_redis_consumer_inflight` | gauge | `stream`, `group`, `node` |
152
+ | `redkern_redis_stream_pending`, `_lag`, `_consumers`, `_dead_letter_length` | gauge | `stream`, `group` (last stream metrics sample) |
153
+
154
+ `_lag` is the estimate from `XINFO GROUPS` (Redis 7+, empty on 6.2). After a failover or `XDEL` Redis may report it as unknown or let it drift for a while; for HPA and alerts prefer `_pending`.
155
+
156
+ ## <a id="control"></a>Control and Kubernetes
157
+
158
+ `pause`, `resume`, `drain` and `status` act on every stream in node of the runtime, optionally filtered by `stream`, `group` or `nodeId`:
159
+
160
+ | Where | Route | Access |
161
+ | --- | --- | --- |
162
+ | stream control node | `msg.payload = { action, stream?, group?, nodeId?, drainTimeoutMs? }` | flow |
163
+ | Admin API | `GET /redkern/redis/streams/status` | `redkern.redis.read` |
164
+ | Admin API | `POST /redkern/redis/streams/control` (JSON body) | `redkern.redis.write` |
165
+ | Admin API | `GET /redkern/redis/connections` | `redkern.redis.read` |
166
+ | Internal port 9551 | `POST /redkern/redis/streams/drain` | loopback only, no token; `REDKERN_REDIS_DRAIN_TOKEN` when the metrics token is set |
167
+ | Internal port 9551 | `GET /redkern/redis/metrics` | `REDKERN_REDIS_METRICS_TOKEN` |
168
+
169
+ Admin routes need `adminAuth`: without it they answer 503 `ADMIN_AUTH_REQUIRED` and the palette logs why once; with it they answer 401 without a valid token. Errors carry a code and a request ID, never internal messages.
170
+
171
+ `drain` stops reading new entries, sends entries already reserved and waits up to `drainTimeoutMs` for an empty own PEL. It answers `200` with `drained: true`, or `504` with `drained: false`. The internal port listens only while stream in nodes exist and the palette is enabled.
172
+
173
+ ### Helm values
174
+
175
+ The preStop hook calls the drain route with Node.js itself, so the image needs no curl. It exits 0 when the port is closed on purpose (`REDKERN_REDIS_ENABLED=false` or no stream in nodes) and non-zero when drain times out, so a failed drain is visible in events.
176
+
177
+ ```yaml
178
+ env:
179
+ - name: REDKERN_REDIS_ENABLED
180
+ value: "true"
181
+ - name: REDKERN_REDIS_METRICS_TOKEN # only without the prometheus palette
182
+ valueFrom: { secretKeyRef: { name: node-red-redis, key: metrics-token } }
183
+ - name: REDKERN_REDIS_DRAIN_TOKEN # required together with METRICS_TOKEN, see below
184
+ valueFrom: { secretKeyRef: { name: node-red-redis, key: drain-token } }
185
+ - name: UV_THREADPOOL_SIZE
186
+ value: "16"
187
+ terminationGracePeriodSeconds: 45 # > drainTimeoutMs (30 s) + 10 s kit close budget
188
+ lifecycle:
189
+ preStop:
190
+ exec:
191
+ command:
192
+ - node
193
+ - -e
194
+ - >-
195
+ const r=require('http').request({host:'127.0.0.1',port:process.env.REDKERN_REDIS_INTERNAL_PORT||9551,
196
+ path:'/redkern/redis/streams/drain',method:'POST',headers:Object.assign({'content-type':'application/json'},
197
+ process.env.REDKERN_REDIS_DRAIN_TOKEN?{authorization:'Bearer '+process.env.REDKERN_REDIS_DRAIN_TOKEN}:{})},
198
+ s=>{s.resume();s.on('end',()=>process.exit(s.statusCode===200?0:1))});
199
+ r.on('error',e=>process.exit(e.code==='ECONNREFUSED'?0:1));
200
+ r.setTimeout(40000,()=>process.exit(1));r.end('{"drainTimeoutMs":30000}')
201
+ readinessProbe:
202
+ httpGet: { path: /, port: 1880 }
203
+ ```
204
+
205
+ `terminationGracePeriodSeconds` must exceed `drainTimeoutMs` plus the 10 s close budget of kit, otherwise Kubernetes kills the pod in the middle of the drain.
206
+
207
+ The internal port is either loopback-only or token-only (kit KIT-HTTP-6). Without `REDKERN_REDIS_METRICS_TOKEN` it listens on `127.0.0.1` and drain needs no token. With the metrics token it listens on `0.0.0.0`, and drain then requires its own `REDKERN_REDIS_DRAIN_TOKEN` (the metrics token does not open it); the fragment above sends it when the variable is set. With the metrics token but without the drain token the drain route is off, the palette logs a warning and the preStop hook fails visibly.
208
+
209
+ ## Settings
210
+
211
+ | Variable | Default | Meaning |
212
+ | --- | --- | --- |
213
+ | `REDKERN_REDIS_ENABLED` | `true` | `false` disables the palette before any I/O; nodes show a grey status |
214
+ | `REDKERN_REDIS_INTERNAL_PORT` | `9551` | Internal port for drain and metrics |
215
+ | `REDKERN_REDIS_METRICS_TOKEN` | none | 32+ printable characters; enables `/metrics` on the internal port |
216
+ | `REDKERN_REDIS_DRAIN_TOKEN` | none | 32+ printable characters; required for drain when the metrics token is set |
217
+
218
+ The internal port must be free: when it is taken (two Node-RED processes sharing one network namespace, for example on a VM or with `hostNetwork`), the palette shows `EADDRINUSE` on every node instead of running without drain and metrics. Give each process its own port.
219
+
220
+ The same values can be set in `settings.js` as `redkernRedisConfigEnabled`, `redkernRedisConfigInternalPort`, `redkernRedisConfigMetricsToken` and `redkernRedisConfigDrainToken`. Logs are prefixed with `[redkern:redis]`.
221
+
222
+ ## Migration from @yroshcha/node-red-contrib-redis-full
223
+
224
+ There is no automatic migrator: move nodes by hand, flow by flow. Both palettes install side by side, so one flow can be moved and deployed at a time.
225
+
226
+ | Legacy type | New type |
227
+ | --- | --- |
228
+ | `yroshcha-redis-config` | `redkern-redis-config` (a new config node next to the legacy one) |
229
+ | `yroshcha-redis-command` | `redkern-redis-command` |
230
+ | `yroshcha-redis-subscribe` in BLPOP/BRPOP mode | `redkern-redis-list-in` |
231
+ | `yroshcha-redis-subscribe` in SUBSCRIBE/PSUBSCRIBE mode | `redkern-redis-subscribe` |
232
+ | `yroshcha-redis-multi`, `-scan`, `-stream-*` | the `redkern-redis-*` type of the same name |
233
+ | `yroshcha-redis-stream-api` | removed: the API is always on the admin API with permissions |
234
+
235
+ What to set by hand:
236
+
237
+ - **config**: create a `redkern-redis-config` with the same host, port, db, user and password. A legacy cluster config becomes **Mode: Cluster** with its host and port as the single seed node. `retryMaxDelay` is gone. Check `maxclients` first: while both palettes run, connections double.
238
+ - **command**: the `block` option is gone and blocking commands are rejected; move them to list in or stream in. If the flow passes `msg.command`, turn on **Allow msg.command**; the denylist now applies to it, and `EVAL`/`EVALSHA` from `msg.command` are rejected: set `EVAL` as the node command and pass the script and keys in `msg.args`.
239
+ - **subscribe in BLPOP/BRPOP mode**: use list in; legacy `topic` goes to **List key**, the mode to **Pop from**. Set **Prefetch** to `0` to keep the legacy intake rate (the default `1` waits for each message to complete).
240
+ - **subscribe in SUBSCRIBE/PSUBSCRIBE mode**: use subscribe with the same channels. The dynamic `msg.subscribe` input is gone.
241
+ - **stream out**: turn on **Allow msg.stream** if the stream comes from `msg.stream`. An empty legacy max length means **MAXLEN** `0` (no trimming).
242
+ - **stream in**: legacy auto-ack becomes **ACK** auto, otherwise manual. Set **Backpressure by** to consumer: the legacy node counted the PEL of the whole group, now Max pending applies per pod. PEL alerts are replaced by the stream metrics node and `redkern_redis_stream_pending`. Consumer names stay the same, so the PEL is picked up.
243
+ - **stream ack**: turn on **Pass the message on** if the flow continues after the ack.
244
+ - **legacy msg fields**: on command, scan, stream out, stream in, stream ack, stream claim and stream gc, turn on **Legacy msg fields** when nodes further down read `msg.streamId`, `msg.stream`, `msg.group`, `msg.consumer`, `msg.scanComplete`, `msg.acked` and the like.
245
+ - **HTTP control**: the legacy `httpNode` routes with an optional token are gone; use stream control, the admin API with permissions, or the loopback drain route for preStop.
246
+
247
+ Remove the legacy palette once no flow uses its types.
248
+
249
+ ## Development
250
+
251
+ ```sh
252
+ npm run build # regenerate editor, catalogs, help and icons from sources
253
+ npm run verify # generated files up to date, lint, editor standard, requirement IDs, unit tests
254
+ npm run test:integration # needs Redis on REDIS_PORT (default 6390)
255
+ scripts/start-test-cluster.sh # 3-master cluster on 7001-7003
256
+ REDIS_CLUSTER_PORTS=7001,7002,7003 npm run test:integration
257
+ scripts/start-test-tls.sh # Redis with TLS on 6391, prints the test CA path
258
+ REDIS_TLS_PORT=6391 NODE_EXTRA_CA_CERTS=<ca.crt> npm run test:integration
259
+ scripts/start-test-tls-cluster.sh <dir> # TLS cluster on 7201-7203 with the same CA
260
+ REDIS_CLUSTER_PORTS=7201,7202,7203 REDIS_CLUSTER_TLS=1 NODE_EXTRA_CA_CERTS=<ca.crt> npm run test:integration
261
+ NODE_RED_PATH=/path/to/node-red-4.1/lib/red.js npm run test:integration
262
+ npm run test:load # acceptance load tests in an embedded runtime
263
+ scripts/start-chaos-cluster.sh && npm run test:chaos # failover, master SIGKILL, live slot migration
264
+ sudo -E npm run test:pods # pods with own hostnames: SIGKILL, preStop drain, SIGTERM (needs root for unshare)
265
+ npm run test:soak -- --minutes 15 # all nodes under load with redeploys; heap, connections, handles
266
+ REDIS_USERNAME=... REDIS_PASSWORD=... npm run test:integration # the suite as a restricted ACL user
267
+ npm run check:pack # contents of the published tarball
268
+ ```
269
+
270
+ Layout:
271
+
272
+ - `nodes/redkern-redis.js` is the only node set. It creates the palette closure (in-flight registry, metrics, routes) once and registers all 13 types, so the state is shared without globals (KIT-ARCH-2).
273
+ - `nodes/redkern-redis-<type>.js` holds one node each; `lib/` holds the logic, tested without Node-RED.
274
+ - Editor sources are `editor/redkern-redis-<type>.html`, `scripts/catalog.en-US.js` and `scripts/help.en-US.js`. `npm run build` writes `nodes/redkern-redis.html`, `nodes/locales/en-US/redkern-redis.{json,html}` and `nodes/icons/`; never edit those by hand.
275
+ - `docs/spec.md` is a copy of the spec. `npm run check:req-ids` fails when a requirement ID has no test with that ID in its name and no `[CI]`, `[лінт]` or `[рев'ю]` tag.
276
+ - `npm run lint` rejects the patterns forbidden by the kit standard: globals, `process` handlers, Node-RED internals, `httpNode` routes and Redis clients created outside kit.
277
+
278
+ ## Security and support
279
+
280
+ Report vulnerabilities through GitHub Private Vulnerability Reporting or to security@redkern.com; see [SECURITY.md](SECURITY.md). General questions: GitHub issues or support@redkern.com.
281
+
282
+ ## License
283
+
284
+ Apache-2.0
package/SECURITY.md ADDED
@@ -0,0 +1,11 @@
1
+ # Security Policy
2
+
3
+ Report vulnerabilities through GitHub Private Vulnerability Reporting or privately to security@redkern.com. Include the affected version, impact, and a minimal reproduction. Do not open a public issue for an unpatched vulnerability.
4
+
5
+ Security-relevant defaults of this palette:
6
+
7
+ - `msg.command` is ignored unless "Allow msg.command" is on, and the command denylist applies to command and multi unless it is disabled explicitly per node.
8
+ - Control and status routes are registered only on the Node-RED admin API with `redkern.redis.read` / `redkern.redis.write` permissions and stay unavailable without `adminAuth`. The drain route on the internal port accepts loopback connections only; the metrics route needs `REDKERN_REDIS_METRICS_TOKEN`.
9
+ - Redis passwords are Node-RED credentials and are redacted from logs and error messages.
10
+
11
+ General support requests belong in GitHub issues or can be sent to support@redkern.com.
@@ -0,0 +1,15 @@
1
+ [
2
+ { "id": "b2f0c0de00000001", "type": "tab", "label": "redis commands", "disabled": false, "info": "Commands, transactions, scans, Pub/Sub and a list queue." },
3
+ { "id": "b2f0c0de0000cfg1", "type": "redkern-redis-config", "name": "redis", "mode": "standalone", "host": "127.0.0.1", "port": "6379", "clusterNodes": "", "db": "0", "username": "", "tls": false, "tlsServername": "", "connectTimeout": "10000", "commandTimeout": "5000", "migratedFrom": "" },
4
+ { "id": "b2f0c0de00000002", "type": "inject", "z": "b2f0c0de00000001", "name": "user:1 name", "props": [{ "p": "args", "v": "[\"user:1\",\"name\"]", "vt": "json" }], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 130, "y": 80, "wires": [["b2f0c0de00000003"]] },
5
+ { "id": "b2f0c0de00000003", "type": "redkern-redis-command", "z": "b2f0c0de00000001", "name": "", "server": "b2f0c0de0000cfg1", "command": "HGET", "allowMsgCommand": false, "disableDenylist": false, "errorOutput": false, "concurrency": "64", "maxQueue": "10000", "legacyMsgFields": false, "outputs": 1, "x": 320, "y": 80, "wires": [["b2f0c0de00000004"]] },
6
+ { "id": "b2f0c0de00000004", "type": "debug", "z": "b2f0c0de00000001", "name": "reply", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 510, "y": 80, "wires": [] },
7
+ { "id": "b2f0c0de00000005", "type": "inject", "z": "b2f0c0de00000001", "name": "counter", "props": [], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 110, "y": 140, "wires": [["b2f0c0de00000006"]] },
8
+ { "id": "b2f0c0de00000006", "type": "redkern-redis-multi", "z": "b2f0c0de00000001", "name": "", "server": "b2f0c0de0000cfg1", "commands": "[[\"INCR\",\"visits\"],[\"EXPIRE\",\"visits\",\"3600\"]]", "disableDenylist": false, "errorOutput": false, "concurrency": "64", "maxQueue": "10000", "outputs": 1, "x": 300, "y": 140, "wires": [["b2f0c0de00000004"]] },
9
+ { "id": "b2f0c0de00000007", "type": "inject", "z": "b2f0c0de00000001", "name": "list users", "props": [], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 120, "y": 200, "wires": [["b2f0c0de00000008"]] },
10
+ { "id": "b2f0c0de00000008", "type": "redkern-redis-scan", "z": "b2f0c0de00000001", "name": "", "server": "b2f0c0de0000cfg1", "scanType": "SCAN", "match": "user:*", "count": "100", "maxResults": "10000", "timeoutMs": "10000", "legacyMsgFields": false, "x": 310, "y": 200, "wires": [["b2f0c0de00000004"]] },
11
+ { "id": "b2f0c0de00000009", "type": "redkern-redis-subscribe", "z": "b2f0c0de00000001", "name": "", "server": "b2f0c0de0000cfg1", "mode": "psubscribe", "channels": "promo:*", "x": 120, "y": 280, "wires": [["b2f0c0de0000000a"]] },
12
+ { "id": "b2f0c0de0000000a", "type": "debug", "z": "b2f0c0de00000001", "name": "pub/sub", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 330, "y": 280, "wires": [] },
13
+ { "id": "b2f0c0de0000000b", "type": "redkern-redis-list-in", "z": "b2f0c0de00000001", "name": "", "server": "b2f0c0de0000cfg1", "key": "legacy:jobs", "direction": "BLPOP", "timeout": "5", "prefetch": "1", "releaseTimeoutMs": "300000", "x": 130, "y": 340, "wires": [["b2f0c0de0000000c"]] },
14
+ { "id": "b2f0c0de0000000c", "type": "debug", "z": "b2f0c0de00000001", "name": "job", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 330, "y": 340, "wires": [] }
15
+ ]
@@ -0,0 +1,23 @@
1
+ [
2
+ { "id": "a1f0c0de00000001", "type": "tab", "label": "redis streams", "disabled": false, "info": "At-least-once processing of a Redis stream: produce, consume, acknowledge, observe and control." },
3
+ { "id": "a1f0c0de0000cfg1", "type": "redkern-redis-config", "name": "redis", "mode": "standalone", "host": "127.0.0.1", "port": "6379", "clusterNodes": "", "db": "0", "username": "", "tls": false, "tlsServername": "", "connectTimeout": "10000", "commandTimeout": "5000", "migratedFrom": "" },
4
+ { "id": "a1f0c0de00000002", "type": "inject", "z": "a1f0c0de00000001", "name": "new order", "props": [{ "p": "payload" }], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "{\"orderId\":42,\"items\":[{\"sku\":\"A-1\",\"qty\":2}]}", "payloadType": "json", "x": 120, "y": 80, "wires": [["a1f0c0de00000003"]] },
5
+ { "id": "a1f0c0de00000003", "type": "redkern-redis-stream-out", "z": "a1f0c0de00000001", "name": "", "server": "a1f0c0de0000cfg1", "streamKey": "orders:queue", "allowMsgStream": false, "maxlen": "0", "approxTrim": true, "unsafeTrim": false, "errorOutput": false, "concurrency": "64", "maxQueue": "10000", "legacyMsgFields": false, "outputs": 1, "x": 320, "y": 80, "wires": [[]] },
6
+ { "id": "a1f0c0de00000004", "type": "redkern-redis-stream-in", "z": "a1f0c0de00000001", "name": "", "server": "a1f0c0de0000cfg1", "streamKey": "orders:queue", "group": "workers", "consumer": "", "ackMode": "manual", "startId": "$", "startPaused": false, "maxPending": "1000", "backpressureScope": "consumer", "maxDeliveries": "5", "deadLetterStream": "", "autoClaim": true, "reclaimIdleMs": "60000", "reclaimIntervalMs": "30000", "reclaimCount": "100", "drainTimeoutMs": "30000", "count": "100", "blockMs": "5000", "readIntervalMs": "0", "rateLimitPerSecond": "0", "batchWindowMs": "0", "batchIntervalMs": "0", "capacityCheckIntervalMs": "250", "capacityPollMs": "500", "initialBackoffMs": "500", "maxBackoffMs": "30000", "backoffMultiplier": "2", "legacyMsgFields": false, "x": 150, "y": 180, "wires": [["a1f0c0de00000005"]] },
7
+ { "id": "a1f0c0de00000005", "type": "function", "z": "a1f0c0de00000001", "name": "process order (idempotent)", "func": "// Redelivery is possible after a crash: key side effects by msg.redkern.redis.id.\nmsg.payload.processedAt = Date.now();\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 400, "y": 180, "wires": [["a1f0c0de00000006", "a1f0c0de00000007"]] },
8
+ { "id": "a1f0c0de00000006", "type": "redkern-redis-stream-ack", "z": "a1f0c0de00000001", "name": "", "server": "a1f0c0de0000cfg1", "streamKey": "", "group": "", "deleteAfterAck": false, "legacyMsgFields": false, "outputs": 0, "x": 640, "y": 160, "wires": [] },
9
+ { "id": "a1f0c0de00000007", "type": "debug", "z": "a1f0c0de00000001", "name": "processed", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 640, "y": 220, "wires": [] },
10
+ { "id": "a1f0c0de00000008", "type": "inject", "z": "a1f0c0de00000001", "name": "every 30 s", "props": [], "repeat": "30", "crontab": "", "once": true, "onceDelay": "5", "topic": "", "x": 130, "y": 300, "wires": [["a1f0c0de00000009"]] },
11
+ { "id": "a1f0c0de00000009", "type": "redkern-redis-stream-metrics", "z": "a1f0c0de00000001", "name": "", "server": "a1f0c0de0000cfg1", "streamKey": "orders:queue", "group": "workers", "deadLetterStream": "orders:queue:dlq", "x": 350, "y": 300, "wires": [["a1f0c0de0000000a"]] },
12
+ { "id": "a1f0c0de0000000a", "type": "debug", "z": "a1f0c0de00000001", "name": "group sample", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 590, "y": 300, "wires": [] },
13
+ { "id": "a1f0c0de0000000b", "type": "inject", "z": "a1f0c0de00000001", "name": "pause", "props": [{ "p": "payload" }], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "{\"action\":\"pause\"}", "payloadType": "json", "x": 110, "y": 380, "wires": [["a1f0c0de0000000d"]] },
14
+ { "id": "a1f0c0de0000000c", "type": "inject", "z": "a1f0c0de00000001", "name": "resume", "props": [{ "p": "payload" }], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "{\"action\":\"resume\"}", "payloadType": "json", "x": 110, "y": 420, "wires": [["a1f0c0de0000000d"]] },
15
+ { "id": "a1f0c0de0000000d", "type": "redkern-redis-stream-control", "z": "a1f0c0de00000001", "name": "", "action": "", "x": 320, "y": 400, "wires": [["a1f0c0de0000000e"]] },
16
+ { "id": "a1f0c0de0000000e", "type": "debug", "z": "a1f0c0de00000001", "name": "control result", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 560, "y": 400, "wires": [] },
17
+ { "id": "a1f0c0de0000000f", "type": "inject", "z": "a1f0c0de00000001", "name": "hourly", "props": [], "repeat": "3600", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 110, "y": 480, "wires": [["a1f0c0de00000010"]] },
18
+ { "id": "a1f0c0de00000010", "type": "redkern-redis-stream-gc", "z": "a1f0c0de00000001", "name": "", "server": "a1f0c0de0000cfg1", "streamKey": "orders:queue", "group": "workers", "minIdleMs": "600000", "legacyMsgFields": false, "x": 320, "y": 480, "wires": [["a1f0c0de00000011"]] },
19
+ { "id": "a1f0c0de00000011", "type": "debug", "z": "a1f0c0de00000001", "name": "gc report", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 540, "y": 480, "wires": [] },
20
+ { "id": "a1f0c0de00000012", "type": "inject", "z": "a1f0c0de00000001", "name": "every 5 min", "props": [], "repeat": "300", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 120, "y": 540, "wires": [["a1f0c0de00000013"]] },
21
+ { "id": "a1f0c0de00000013", "type": "redkern-redis-stream-claim", "z": "a1f0c0de00000001", "name": "", "server": "a1f0c0de0000cfg1", "streamKey": "orders:queue", "group": "workers", "consumer": "", "minIdleMs": "300000", "count": "100", "maxMessages": "1000", "legacyMsgFields": false, "x": 330, "y": 540, "wires": [["a1f0c0de00000014"]] },
22
+ { "id": "a1f0c0de00000014", "type": "debug", "z": "a1f0c0de00000001", "name": "claimed", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 540, "y": 540, "wires": [] }
23
+ ]