@pauldeng/node-red-contrib-bullmq 1.0.2 → 2.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.
- package/README.md +62 -42
- package/bull-queue.html +300 -91
- package/bull-queue.js +686 -143
- package/docs/ARCHITECTURE.md +63 -17
- package/docs/CHANGE_WORKFLOW.md +10 -11
- package/docs/COMMANDS.md +72 -11
- package/docs/CONNECTIONS.md +74 -7
- package/docs/MIGRATION.md +56 -22
- package/docs/NODE_GUIDE.md +52 -14
- package/docs/REFERENCE_MAP.md +29 -10
- package/docs/RELEASE.md +18 -5
- package/docs/RULES.md +33 -0
- package/docs/TELEMETRY.md +55 -0
- package/docs/TESTING.md +30 -16
- package/docs/TROUBLESHOOTING.md +44 -5
- package/examples/README.md +40 -12
- package/examples/bullmq_features.json +218 -16
- package/examples/example_flow.json +11 -11
- package/examples/postgres_backend.json +149 -0
- package/examples/repeatable_jobs.json +51 -19
- package/examples/scheduled_notifications.json +216 -0
- package/lib/acknowledgements.js +19 -1
- package/lib/commands.js +74 -35
- package/lib/connections.js +271 -48
- package/lib/scheduler.js +5 -74
- package/lib/serialization.js +1 -4
- package/package.json +25 -9
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
[](https://scorecard.dev/viewer/?uri=github.com/pauldeng/node-red-contrib-bullmq)
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
|
|
9
|
-
Node-RED nodes for BullMQ
|
|
9
|
+
Node-RED nodes for BullMQ job queues, backed by Redis or PostgreSQL.
|
|
10
10
|
|
|
11
|
-
This package targets BullMQ
|
|
11
|
+
This package targets BullMQ 6.3.1 and Node-RED 5. Version 2 is a breaking release: it uses BullMQ v6 node names, commands, and Job Scheduler inputs only.
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -23,23 +23,34 @@ Repository: <https://github.com/pauldeng/node-red-contrib-bullmq>
|
|
|
23
23
|
|
|
24
24
|
## Requirements
|
|
25
25
|
|
|
26
|
-
- Node-RED
|
|
27
|
-
- Node.js
|
|
28
|
-
-
|
|
29
|
-
-
|
|
26
|
+
- Node-RED 5.x
|
|
27
|
+
- Node.js 22.9+
|
|
28
|
+
- BullMQ 6.3.1
|
|
29
|
+
- One backend per queue config: Redis, or PostgreSQL 13+ (14+ recommended) with the optional peer dependency `pg` installed
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
For the Redis backend:
|
|
32
|
+
|
|
33
|
+
- Redis with `maxmemory-policy=noeviction`; evicting arbitrary BullMQ keys can corrupt queue behavior
|
|
34
|
+
- Durable Redis persistence; for self-managed Redis, BullMQ recommends Append Only File (AOF) persistence
|
|
35
|
+
|
|
36
|
+
BullMQ stores job data in clear text, in either backend. Do not put secrets or other sensitive data in a job payload unless the sensitive fields are encrypted before the job is added.
|
|
37
|
+
|
|
38
|
+
Bull v4 Redis data is not automatically migrated. Drain, retire, or otherwise handle old Bull queues before upgrading the runtime dependency. Upgrading from a BullMQ v5 release of this package has its own steps; see [docs/MIGRATION.md](docs/MIGRATION.md).
|
|
32
39
|
|
|
33
40
|
## Nodes
|
|
34
41
|
|
|
35
|
-
- `
|
|
36
|
-
- `
|
|
37
|
-
- `
|
|
38
|
-
- `
|
|
39
|
-
- `
|
|
40
|
-
- `
|
|
42
|
+
- `bullmq-queue-server`: shared BullMQ queue and backend connection config, for Redis or PostgreSQL.
|
|
43
|
+
- `bullmq cmd`: message-driven producer and queue administration commands.
|
|
44
|
+
- `bullmq run`: BullMQ Worker that emits jobs into a Node-RED flow and caps each job at 100 processing starts by default.
|
|
45
|
+
- `bullmq job`: manual acknowledgement and active-job actions for manual `bullmq run` flows.
|
|
46
|
+
- `bullmq events`: QueueEvents source node for global BullMQ events.
|
|
47
|
+
- `bullmq flow`: FlowProducer node for parent/child job trees.
|
|
48
|
+
|
|
49
|
+
## Backends
|
|
50
|
+
|
|
51
|
+
Each queue config node picks one backend. TLS serves both, with CA, client certificate, client key, server name, and certificate verification.
|
|
41
52
|
|
|
42
|
-
|
|
53
|
+
### Redis
|
|
43
54
|
|
|
44
55
|
Supported deployment modes:
|
|
45
56
|
|
|
@@ -48,29 +59,39 @@ Supported deployment modes:
|
|
|
48
59
|
- AWS MemoryDB, configured as Redis Cluster with TLS
|
|
49
60
|
- Redis Sentinel
|
|
50
61
|
|
|
51
|
-
Authentication can use Redis ACL username/password.
|
|
62
|
+
Authentication can use Redis ACL username/password. Cluster and MemoryDB prefixes must contain a hash tag, such as `{bull}`, to keep queue keys in one Redis Cluster slot for atomic operations.
|
|
52
63
|
|
|
53
|
-
|
|
64
|
+
Independent queues may use different hash tags to spread load. Prefixes used in one `bullmq flow` tree or bulk flow batch must contain the same hash tag; each worker must use the exact prefix assigned to its queue in that flow.
|
|
54
65
|
|
|
55
|
-
|
|
66
|
+
### PostgreSQL
|
|
67
|
+
|
|
68
|
+
Host, port, database, username, password, plus a schema (`bullmq` by default), a connection pool size, and a migrations switch that creates and updates BullMQ's schema on connect. Install `pg` first (`npm install pg`); it is an optional peer dependency, and a missing install is reported once per config node on first use rather than at load.
|
|
69
|
+
|
|
70
|
+
There is no Cluster or Sentinel topology, and no key prefix — both are Redis concepts. Budget the server's `max_connections` across every pool, and note that PostgreSQL event rows are never trimmed. Full details, including what PostgreSQL does not have, are in [docs/CONNECTIONS.md](docs/CONNECTIONS.md#postgresql).
|
|
71
|
+
|
|
72
|
+
## Job Schedulers
|
|
73
|
+
|
|
74
|
+
Use the native BullMQ v6 Job Scheduler shape:
|
|
56
75
|
|
|
57
76
|
```js
|
|
58
|
-
msg.
|
|
59
|
-
msg.
|
|
60
|
-
msg.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
msg.cmd = "upsertJobScheduler";
|
|
78
|
+
msg.schedulerId = "gateway-FCC23DFFFE0AA2A8";
|
|
79
|
+
msg.repeat = {
|
|
80
|
+
pattern: "30 9,19,29,39,49,59 * * * *",
|
|
81
|
+
tz: "UTC",
|
|
82
|
+
};
|
|
83
|
+
msg.template = {
|
|
84
|
+
name: "default",
|
|
85
|
+
data: { payload: "gateway-FCC23DFFFE0AA2A8" },
|
|
65
86
|
};
|
|
66
87
|
return msg;
|
|
67
88
|
```
|
|
68
89
|
|
|
69
|
-
|
|
90
|
+
Lookup and removal commands require the exact id in `msg.schedulerId`.
|
|
70
91
|
|
|
71
92
|
## Commands
|
|
72
93
|
|
|
73
|
-
`
|
|
94
|
+
`bullmq cmd` reads `msg.cmd`; the default command is `add`.
|
|
74
95
|
|
|
75
96
|
Core supported command families include:
|
|
76
97
|
|
|
@@ -78,7 +99,7 @@ Core supported command families include:
|
|
|
78
99
|
- delayed jobs and delay promotion
|
|
79
100
|
- priorities and priority counts
|
|
80
101
|
- deduplication keys
|
|
81
|
-
- Job Scheduler commands
|
|
102
|
+
- BullMQ v6 Job Scheduler commands
|
|
82
103
|
- pause, resume, drain, clean, and `stopAndRemoveAllJobs`
|
|
83
104
|
- global concurrency and rate limits
|
|
84
105
|
- job logs and Prometheus metrics export
|
|
@@ -87,25 +108,23 @@ See [docs/COMMANDS.md](docs/COMMANDS.md).
|
|
|
87
108
|
|
|
88
109
|
## Unsupported
|
|
89
110
|
|
|
90
|
-
| BullMQ feature | Reason
|
|
91
|
-
| -------------------------------------- |
|
|
92
|
-
| Sandboxed processors | They bypass the Node-RED flow and downstream acknowledgement model.
|
|
93
|
-
| Custom JavaScript backoff strategies | Executable strategy code is not a safe Node-RED message contract. Use built-in fixed/exponential backoff.
|
|
94
|
-
| BullMQ Pro features | Pro groups, batches, and observables are not part of the open-source BullMQ dependency.
|
|
95
|
-
| Built-in dashboard | Use a dedicated queue UI; this package only provides Node-RED nodes.
|
|
96
|
-
| Arbitrary method proxying | Unrestricted method dispatch is hard to validate, document, secure, and test.
|
|
97
|
-
|
|
|
111
|
+
| BullMQ feature | Reason |
|
|
112
|
+
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
113
|
+
| Sandboxed processors | They bypass the Node-RED flow and downstream acknowledgement model. |
|
|
114
|
+
| Custom JavaScript backoff strategies | Executable strategy code is not a safe Node-RED message contract. Use built-in fixed/exponential backoff. |
|
|
115
|
+
| BullMQ Pro features | Pro groups, batches, and observables are not part of the open-source BullMQ dependency. |
|
|
116
|
+
| Built-in dashboard | Use a dedicated queue UI; this package only provides Node-RED nodes. |
|
|
117
|
+
| Arbitrary method proxying | Unrestricted method dispatch is hard to validate, document, secure, and test. |
|
|
118
|
+
| Dynamic child creation | Declare dependencies up front with `bullmq flow`; processor-owned `moveToWaitingChildren` wiring is not exposed. |
|
|
119
|
+
| Automatic Bull v4 Redis data migration | Bull and BullMQ do not provide a supported queue-data migration contract. |
|
|
98
120
|
|
|
99
121
|
## Examples
|
|
100
122
|
|
|
101
|
-
Import
|
|
123
|
+
Import any of these flows into Node-RED:
|
|
102
124
|
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
- manual acknowledgement
|
|
107
|
-
- QueueEvents
|
|
108
|
-
- parent/child flow producer
|
|
125
|
+
- [examples/example_flow.json](examples/example_flow.json): an end-to-end flow with add/run, a Job Scheduler, delayed and prioritized jobs, manual acknowledgement, QueueEvents, and a parent/child flow.
|
|
126
|
+
- [examples/bullmq_features.json](examples/bullmq_features.json): focused examples, including one delayed job, a batch with increasing delays, and a series targeted at exact ISO date-times.
|
|
127
|
+
- [examples/repeatable_jobs.json](examples/repeatable_jobs.json): native BullMQ v6 Job Scheduler examples.
|
|
109
128
|
|
|
110
129
|
The examples do not contain secrets.
|
|
111
130
|
|
|
@@ -123,6 +142,7 @@ Use [docs/TESTING.md](docs/TESTING.md) for Docker, Playwright, and MemoryDB test
|
|
|
123
142
|
- [Architecture](docs/ARCHITECTURE.md)
|
|
124
143
|
- [Node Guide](docs/NODE_GUIDE.md)
|
|
125
144
|
- [Connection Guide](docs/CONNECTIONS.md)
|
|
145
|
+
- [Telemetry Guide](docs/TELEMETRY.md)
|
|
126
146
|
- [Migration Guide](docs/MIGRATION.md)
|
|
127
147
|
- [Troubleshooting](docs/TROUBLESHOOTING.md)
|
|
128
148
|
- [Changelog](CHANGELOG.md)
|