@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 CHANGED
@@ -6,9 +6,9 @@
6
6
  [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/pauldeng/node-red-contrib-bullmq/badge)](https://scorecard.dev/viewer/?uri=github.com/pauldeng/node-red-contrib-bullmq)
7
7
  [![License: MIT](https://img.shields.io/npm/l/@pauldeng/node-red-contrib-bullmq.svg)](LICENSE)
8
8
 
9
- Node-RED nodes for BullMQ-backed Redis job queues.
9
+ Node-RED nodes for BullMQ job queues, backed by Redis or PostgreSQL.
10
10
 
11
- This package targets BullMQ 5.80.2 and Node-RED 4.1 or 5.x. It preserves the legacy `bull-queue-server`, `bull cmd`, and `bull run` node types where BullMQ has compatible behavior, and adds `bull job`, `bull events`, and `bull flow`.
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 4.1.x or 5.x
27
- - Node.js 18+ with Node-RED 4.1.x, or Node.js 22.9+ with Node-RED 5.x
28
- - Redis with `maxmemory-policy=noeviction`
29
- - BullMQ 5.80.2
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
- Bull v4 Redis data is not automatically migrated. Drain, retire, or otherwise handle old Bull queues before upgrading the runtime dependency.
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
- - `bull-queue-server`: shared BullMQ queue and Redis deployment config.
36
- - `bull cmd`: message-driven producer and queue administration commands.
37
- - `bull run`: BullMQ Worker that emits jobs into a Node-RED flow.
38
- - `bull job`: manual acknowledgement and active-job actions for manual `bull run` flows.
39
- - `bull events`: QueueEvents source node for global BullMQ events.
40
- - `bull flow`: FlowProducer node for parent/child job trees.
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
- ## Redis Deployments
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. TLS supports CA, client certificate, client key, server name, and certificate verification. Cluster and MemoryDB prefixes must contain a hash tag, such as `{bull}`, to keep queue keys in one Redis Cluster slot for atomic operations.
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
- ## Legacy Repeat Cron Compatibility
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
- The legacy repeat flow remains supported through BullMQ Job Schedulers:
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.payload = "gateway-FCC23DFFFE0AA2A8";
59
- msg.cmd = "add";
60
- msg.jobopts = {
61
- jobId: msg.payload,
62
- repeat: {
63
- cron: "30 9,19,29,39,49,59 * * * *",
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
- The scheduler id is `msg.schedulerId` when present, otherwise `msg.jobopts.jobId`. `repeat.cron` is translated to `repeat.pattern`; conflicting `cron` and `pattern` values are rejected.
90
+ Lookup and removal commands require the exact id in `msg.schedulerId`.
70
91
 
71
92
  ## Commands
72
93
 
73
- `bull cmd` reads `msg.cmd`. The default command is `add`.
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 and legacy repeat aliases
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
- | Automatic Bull v4 Redis data migration | Bull and BullMQ do not provide a supported queue-data migration contract. |
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 [examples/example_flow.json](examples/example_flow.json) into Node-RED. It includes:
123
+ Import any of these flows into Node-RED:
102
124
 
103
- - simple add and run
104
- - required `basecasts` scheduled job
105
- - delayed and prioritized jobs
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)