@pauldeng/node-red-contrib-bullmq 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.
@@ -0,0 +1,331 @@
1
+ [
2
+ {
3
+ "id": "flow-bullmq-features",
4
+ "type": "tab",
5
+ "label": "BullMQ feature examples",
6
+ "disabled": false,
7
+ "info": "Simple BullMQ examples for Node-RED: delayed jobs, priorities, deduplication, rate limits, schedulers, events, manual acknowledgement, and flows."
8
+ },
9
+ {
10
+ "id": "queue-bullmq-features",
11
+ "type": "bull-queue-server",
12
+ "name": "bullmq-features",
13
+ "deployment": "single",
14
+ "address": "localhost",
15
+ "port": "6379",
16
+ "db": "",
17
+ "clusterNodes": "",
18
+ "sentinels": "",
19
+ "sentinelMasterName": "",
20
+ "username": "",
21
+ "sentinelUsername": "",
22
+ "tls": false,
23
+ "sentinelTls": false,
24
+ "tlsRejectUnauthorized": true,
25
+ "tlsServerName": "",
26
+ "prefix": ""
27
+ },
28
+ {
29
+ "id": "inject-delay-example",
30
+ "type": "inject",
31
+ "z": "flow-bullmq-features",
32
+ "name": "delay: send later",
33
+ "props": [{ "p": "payload" }],
34
+ "repeat": "",
35
+ "crontab": "",
36
+ "once": false,
37
+ "onceDelay": 0.1,
38
+ "topic": "",
39
+ "payload": "run this job after 10 seconds",
40
+ "payloadType": "str",
41
+ "x": 160,
42
+ "y": 100,
43
+ "wires": [["fn-delay-example"]]
44
+ },
45
+ {
46
+ "id": "fn-delay-example",
47
+ "type": "function",
48
+ "z": "flow-bullmq-features",
49
+ "name": "msg.jobopts.delay",
50
+ "func": "msg.cmd = \"add\";\nmsg.jobName = \"delayed\";\nmsg.jobopts = {\n delay: 10000,\n removeOnComplete: true\n};\nreturn msg;",
51
+ "outputs": 1,
52
+ "noerr": 0,
53
+ "initialize": "",
54
+ "finalize": "",
55
+ "libs": [],
56
+ "x": 410,
57
+ "y": 100,
58
+ "wires": [["cmd-feature-examples"]]
59
+ },
60
+ {
61
+ "id": "inject-priority-example",
62
+ "type": "inject",
63
+ "z": "flow-bullmq-features",
64
+ "name": "priority: high priority",
65
+ "props": [{ "p": "payload" }],
66
+ "repeat": "",
67
+ "crontab": "",
68
+ "once": false,
69
+ "onceDelay": 0.1,
70
+ "topic": "",
71
+ "payload": "process before normal priority jobs",
72
+ "payloadType": "str",
73
+ "x": 180,
74
+ "y": 180,
75
+ "wires": [["fn-priority-example"]]
76
+ },
77
+ {
78
+ "id": "fn-priority-example",
79
+ "type": "function",
80
+ "z": "flow-bullmq-features",
81
+ "name": "msg.jobopts.priority",
82
+ "func": "msg.cmd = \"add\";\nmsg.jobName = \"priority\";\nmsg.jobopts = {\n priority: 1,\n removeOnComplete: true\n};\nreturn msg;",
83
+ "outputs": 1,
84
+ "noerr": 0,
85
+ "initialize": "",
86
+ "finalize": "",
87
+ "libs": [],
88
+ "x": 420,
89
+ "y": 180,
90
+ "wires": [["cmd-feature-examples"]]
91
+ },
92
+ {
93
+ "id": "inject-dedupe-example",
94
+ "type": "inject",
95
+ "z": "flow-bullmq-features",
96
+ "name": "dedupe: same job once",
97
+ "props": [{ "p": "payload" }],
98
+ "repeat": "",
99
+ "crontab": "",
100
+ "once": false,
101
+ "onceDelay": 0.1,
102
+ "topic": "",
103
+ "payload": "customer-42-report",
104
+ "payloadType": "str",
105
+ "x": 170,
106
+ "y": 260,
107
+ "wires": [["fn-dedupe-example"]]
108
+ },
109
+ {
110
+ "id": "fn-dedupe-example",
111
+ "type": "function",
112
+ "z": "flow-bullmq-features",
113
+ "name": "msg.jobopts.deduplication",
114
+ "func": "msg.cmd = \"add\";\nmsg.jobName = \"deduplicated\";\nmsg.jobopts = {\n deduplication: { id: msg.payload },\n removeOnComplete: true\n};\nreturn msg;",
115
+ "outputs": 1,
116
+ "noerr": 0,
117
+ "initialize": "",
118
+ "finalize": "",
119
+ "libs": [],
120
+ "x": 440,
121
+ "y": 260,
122
+ "wires": [["cmd-feature-examples"]]
123
+ },
124
+ {
125
+ "id": "inject-rate-limit-example",
126
+ "type": "inject",
127
+ "z": "flow-bullmq-features",
128
+ "name": "rate limit: 2 per second",
129
+ "props": [{ "p": "payload" }],
130
+ "repeat": "",
131
+ "crontab": "",
132
+ "once": false,
133
+ "onceDelay": 0.1,
134
+ "topic": "",
135
+ "payload": "{\"max\":2,\"duration\":1000}",
136
+ "payloadType": "json",
137
+ "x": 180,
138
+ "y": 340,
139
+ "wires": [["fn-rate-limit-example"]]
140
+ },
141
+ {
142
+ "id": "fn-rate-limit-example",
143
+ "type": "function",
144
+ "z": "flow-bullmq-features",
145
+ "name": "setGlobalRateLimit",
146
+ "func": "msg.cmd = \"setGlobalRateLimit\";\nreturn msg;",
147
+ "outputs": 1,
148
+ "noerr": 0,
149
+ "initialize": "",
150
+ "finalize": "",
151
+ "libs": [],
152
+ "x": 430,
153
+ "y": 340,
154
+ "wires": [["cmd-feature-examples"]]
155
+ },
156
+ {
157
+ "id": "inject-scheduler-example",
158
+ "type": "inject",
159
+ "z": "flow-bullmq-features",
160
+ "name": "scheduler: every minute",
161
+ "props": [{ "p": "payload" }],
162
+ "repeat": "",
163
+ "crontab": "",
164
+ "once": false,
165
+ "onceDelay": 0.1,
166
+ "topic": "",
167
+ "payload": "scheduled heartbeat",
168
+ "payloadType": "str",
169
+ "x": 180,
170
+ "y": 420,
171
+ "wires": [["fn-scheduler-example"]]
172
+ },
173
+ {
174
+ "id": "fn-scheduler-example",
175
+ "type": "function",
176
+ "z": "flow-bullmq-features",
177
+ "name": "repeat.pattern",
178
+ "func": "msg.cmd = \"add\";\nmsg.jobName = \"heartbeat\";\nmsg.jobopts = {\n jobId: \"heartbeat-every-minute\",\n repeat: { pattern: \"*/1 * * * *\" },\n removeOnComplete: true\n};\nreturn msg;",
179
+ "outputs": 1,
180
+ "noerr": 0,
181
+ "initialize": "",
182
+ "finalize": "",
183
+ "libs": [],
184
+ "x": 410,
185
+ "y": 420,
186
+ "wires": [["cmd-feature-examples"]]
187
+ },
188
+ {
189
+ "id": "cmd-feature-examples",
190
+ "type": "bull cmd",
191
+ "z": "flow-bullmq-features",
192
+ "name": "send command",
193
+ "queue": "queue-bullmq-features",
194
+ "x": 690,
195
+ "y": 260,
196
+ "wires": [["debug-feature-command"]]
197
+ },
198
+ {
199
+ "id": "run-immediate-example",
200
+ "type": "bull run",
201
+ "z": "flow-bullmq-features",
202
+ "name": "worker: immediate complete",
203
+ "queue": "queue-bullmq-features",
204
+ "completionMode": "immediate",
205
+ "ackTimeout": 300000,
206
+ "concurrency": 1,
207
+ "limiterMax": "",
208
+ "limiterDuration": "",
209
+ "x": 190,
210
+ "y": 540,
211
+ "wires": [["debug-worker-output"]]
212
+ },
213
+ {
214
+ "id": "run-manual-example",
215
+ "type": "bull run",
216
+ "z": "flow-bullmq-features",
217
+ "name": "manual ack worker",
218
+ "queue": "queue-bullmq-features",
219
+ "completionMode": "manual",
220
+ "ackTimeout": 300000,
221
+ "concurrency": 1,
222
+ "limiterMax": "",
223
+ "limiterDuration": "",
224
+ "x": 170,
225
+ "y": 620,
226
+ "wires": [["job-progress-example"]]
227
+ },
228
+ {
229
+ "id": "job-progress-example",
230
+ "type": "bull job",
231
+ "z": "flow-bullmq-features",
232
+ "name": "progress 50%",
233
+ "action": "progress",
234
+ "x": 390,
235
+ "y": 620,
236
+ "wires": [["job-complete-example"]]
237
+ },
238
+ {
239
+ "id": "job-complete-example",
240
+ "type": "bull job",
241
+ "z": "flow-bullmq-features",
242
+ "name": "complete job",
243
+ "action": "complete",
244
+ "x": 610,
245
+ "y": 620,
246
+ "wires": [["debug-worker-output"]]
247
+ },
248
+ {
249
+ "id": "events-feature-example",
250
+ "type": "bull events",
251
+ "z": "flow-bullmq-features",
252
+ "name": "events: completed failed delayed deduped",
253
+ "queue": "queue-bullmq-features",
254
+ "events": "completed,failed,delayed,deduplicated,duplicated,progress",
255
+ "x": 220,
256
+ "y": 720,
257
+ "wires": [["debug-feature-events"]]
258
+ },
259
+ {
260
+ "id": "inject-flow-example",
261
+ "type": "inject",
262
+ "z": "flow-bullmq-features",
263
+ "name": "flow: parent plus child",
264
+ "props": [{ "p": "payload" }],
265
+ "repeat": "",
266
+ "crontab": "",
267
+ "once": false,
268
+ "onceDelay": 0.1,
269
+ "topic": "",
270
+ "payload": "{\"name\":\"parent-report\",\"queueName\":\"bullmq-features\",\"data\":{\"payload\":\"parent\"},\"children\":[{\"name\":\"child-report\",\"queueName\":\"bullmq-features\",\"data\":{\"payload\":\"child\"}}]}",
271
+ "payloadType": "json",
272
+ "x": 190,
273
+ "y": 820,
274
+ "wires": [["flow-feature-example"]]
275
+ },
276
+ {
277
+ "id": "flow-feature-example",
278
+ "type": "bull flow",
279
+ "z": "flow-bullmq-features",
280
+ "name": "add parent/child flow",
281
+ "queue": "queue-bullmq-features",
282
+ "x": 450,
283
+ "y": 820,
284
+ "wires": [["debug-feature-command"]]
285
+ },
286
+ {
287
+ "id": "debug-feature-command",
288
+ "type": "debug",
289
+ "z": "flow-bullmq-features",
290
+ "name": "command result",
291
+ "active": true,
292
+ "tosidebar": true,
293
+ "console": false,
294
+ "tostatus": false,
295
+ "complete": "true",
296
+ "targetType": "full",
297
+ "x": 940,
298
+ "y": 260,
299
+ "wires": []
300
+ },
301
+ {
302
+ "id": "debug-worker-output",
303
+ "type": "debug",
304
+ "z": "flow-bullmq-features",
305
+ "name": "worker output",
306
+ "active": true,
307
+ "tosidebar": true,
308
+ "console": false,
309
+ "tostatus": false,
310
+ "complete": "true",
311
+ "targetType": "full",
312
+ "x": 900,
313
+ "y": 600,
314
+ "wires": []
315
+ },
316
+ {
317
+ "id": "debug-feature-events",
318
+ "type": "debug",
319
+ "z": "flow-bullmq-features",
320
+ "name": "event output",
321
+ "active": true,
322
+ "tosidebar": true,
323
+ "console": false,
324
+ "tostatus": false,
325
+ "complete": "true",
326
+ "targetType": "full",
327
+ "x": 900,
328
+ "y": 720,
329
+ "wires": []
330
+ }
331
+ ]
@@ -0,0 +1,277 @@
1
+ [
2
+ {
3
+ "id": "flow-basecasts",
4
+ "type": "tab",
5
+ "label": "BullMQ basecasts examples",
6
+ "disabled": false,
7
+ "info": ""
8
+ },
9
+ {
10
+ "id": "queue-basecasts",
11
+ "type": "bull-queue-server",
12
+ "name": "basecasts",
13
+ "deployment": "single",
14
+ "address": "localhost",
15
+ "port": "6379",
16
+ "db": "",
17
+ "clusterNodes": "",
18
+ "sentinels": "",
19
+ "sentinelMasterName": "",
20
+ "username": "",
21
+ "sentinelUsername": "",
22
+ "tls": false,
23
+ "sentinelTls": false,
24
+ "tlsRejectUnauthorized": true,
25
+ "tlsServerName": "",
26
+ "prefix": ""
27
+ },
28
+ {
29
+ "id": "inject-simple",
30
+ "type": "inject",
31
+ "z": "flow-basecasts",
32
+ "name": "simple add",
33
+ "props": [{ "p": "payload" }],
34
+ "repeat": "",
35
+ "crontab": "",
36
+ "once": false,
37
+ "onceDelay": 0.1,
38
+ "topic": "",
39
+ "payload": "hello bullmq",
40
+ "payloadType": "str",
41
+ "x": 150,
42
+ "y": 120,
43
+ "wires": [["fn-simple"]]
44
+ },
45
+ {
46
+ "id": "fn-simple",
47
+ "type": "function",
48
+ "z": "flow-basecasts",
49
+ "name": "cmd add",
50
+ "func": "msg.cmd = \"add\";\nmsg.jobopts = { removeOnComplete: true };\nreturn msg;",
51
+ "outputs": 1,
52
+ "noerr": 0,
53
+ "initialize": "",
54
+ "finalize": "",
55
+ "libs": [],
56
+ "x": 340,
57
+ "y": 120,
58
+ "wires": [["cmd-simple"]]
59
+ },
60
+ {
61
+ "id": "cmd-simple",
62
+ "type": "bull cmd",
63
+ "z": "flow-basecasts",
64
+ "name": "add simple",
65
+ "queue": "queue-basecasts",
66
+ "x": 530,
67
+ "y": 120,
68
+ "wires": [["debug-cmd"]]
69
+ },
70
+ {
71
+ "id": "run-immediate",
72
+ "type": "bull run",
73
+ "z": "flow-basecasts",
74
+ "name": "run immediate",
75
+ "queue": "queue-basecasts",
76
+ "completionMode": "immediate",
77
+ "ackTimeout": 300000,
78
+ "concurrency": 1,
79
+ "limiterMax": "",
80
+ "limiterDuration": "",
81
+ "x": 530,
82
+ "y": 220,
83
+ "wires": [["debug-run"]]
84
+ },
85
+ {
86
+ "id": "inject-required-schedule",
87
+ "type": "inject",
88
+ "z": "flow-basecasts",
89
+ "name": "required basecasts schedule",
90
+ "props": [{ "p": "payload" }],
91
+ "repeat": "",
92
+ "crontab": "",
93
+ "once": false,
94
+ "onceDelay": 0.1,
95
+ "topic": "",
96
+ "payload": "gateway-FCC23DFFFE0AA2A8",
97
+ "payloadType": "str",
98
+ "x": 180,
99
+ "y": 320,
100
+ "wires": [["fn-required-schedule"]]
101
+ },
102
+ {
103
+ "id": "fn-required-schedule",
104
+ "type": "function",
105
+ "z": "flow-basecasts",
106
+ "name": "add required repeat cron",
107
+ "func": "msg.cmd = \"add\";\nmsg.jobopts = {\n jobId: msg.payload,\n removeOnComplete: true,\n repeat: {\n cron: \"30 9,19,29,39,49,59 * * * *\"\n }\n};\nreturn msg;",
108
+ "outputs": 1,
109
+ "noerr": 0,
110
+ "initialize": "",
111
+ "finalize": "",
112
+ "libs": [],
113
+ "x": 420,
114
+ "y": 320,
115
+ "wires": [["cmd-required-schedule"]]
116
+ },
117
+ {
118
+ "id": "cmd-required-schedule",
119
+ "type": "bull cmd",
120
+ "z": "flow-basecasts",
121
+ "name": "upsert scheduler",
122
+ "queue": "queue-basecasts",
123
+ "x": 680,
124
+ "y": 320,
125
+ "wires": [["debug-cmd"]]
126
+ },
127
+ {
128
+ "id": "inject-delayed-priority",
129
+ "type": "inject",
130
+ "z": "flow-basecasts",
131
+ "name": "delayed priority",
132
+ "props": [{ "p": "payload" }],
133
+ "repeat": "",
134
+ "crontab": "",
135
+ "once": false,
136
+ "onceDelay": 0.1,
137
+ "topic": "",
138
+ "payload": "delayed high priority",
139
+ "payloadType": "str",
140
+ "x": 170,
141
+ "y": 420,
142
+ "wires": [["fn-delayed-priority"]]
143
+ },
144
+ {
145
+ "id": "fn-delayed-priority",
146
+ "type": "function",
147
+ "z": "flow-basecasts",
148
+ "name": "delay priority opts",
149
+ "func": "msg.cmd = \"add\";\nmsg.jobopts = {\n delay: 5000,\n priority: 1,\n removeOnComplete: true\n};\nreturn msg;",
150
+ "outputs": 1,
151
+ "noerr": 0,
152
+ "initialize": "",
153
+ "finalize": "",
154
+ "libs": [],
155
+ "x": 390,
156
+ "y": 420,
157
+ "wires": [["cmd-delayed-priority"]]
158
+ },
159
+ {
160
+ "id": "cmd-delayed-priority",
161
+ "type": "bull cmd",
162
+ "z": "flow-basecasts",
163
+ "name": "add delayed priority",
164
+ "queue": "queue-basecasts",
165
+ "x": 650,
166
+ "y": 420,
167
+ "wires": [["debug-cmd"]]
168
+ },
169
+ {
170
+ "id": "events-basecasts",
171
+ "type": "bull events",
172
+ "z": "flow-basecasts",
173
+ "name": "events",
174
+ "queue": "queue-basecasts",
175
+ "events": "completed,failed,progress,delayed,deduplicated,duplicated",
176
+ "x": 150,
177
+ "y": 540,
178
+ "wires": [["debug-events"]]
179
+ },
180
+ {
181
+ "id": "run-manual",
182
+ "type": "bull run",
183
+ "z": "flow-basecasts",
184
+ "name": "run manual",
185
+ "queue": "queue-basecasts",
186
+ "completionMode": "manual",
187
+ "ackTimeout": 300000,
188
+ "concurrency": 1,
189
+ "limiterMax": "",
190
+ "limiterDuration": "",
191
+ "x": 160,
192
+ "y": 640,
193
+ "wires": [["job-complete"]]
194
+ },
195
+ {
196
+ "id": "job-complete",
197
+ "type": "bull job",
198
+ "z": "flow-basecasts",
199
+ "name": "complete manual job",
200
+ "action": "complete",
201
+ "x": 400,
202
+ "y": 640,
203
+ "wires": [["debug-run"]]
204
+ },
205
+ {
206
+ "id": "inject-flow",
207
+ "type": "inject",
208
+ "z": "flow-basecasts",
209
+ "name": "parent child flow",
210
+ "props": [{ "p": "payload" }],
211
+ "repeat": "",
212
+ "crontab": "",
213
+ "once": false,
214
+ "onceDelay": 0.1,
215
+ "topic": "",
216
+ "payload": "{\"name\":\"parent\",\"queueName\":\"basecasts\",\"data\":{\"payload\":\"parent\"},\"children\":[{\"name\":\"child\",\"queueName\":\"basecasts\",\"data\":{\"payload\":\"child\"}}]}",
217
+ "payloadType": "json",
218
+ "x": 170,
219
+ "y": 740,
220
+ "wires": [["flow-producer"]]
221
+ },
222
+ {
223
+ "id": "flow-producer",
224
+ "type": "bull flow",
225
+ "z": "flow-basecasts",
226
+ "name": "add flow",
227
+ "queue": "queue-basecasts",
228
+ "x": 390,
229
+ "y": 740,
230
+ "wires": [["debug-cmd"]]
231
+ },
232
+ {
233
+ "id": "debug-cmd",
234
+ "type": "debug",
235
+ "z": "flow-basecasts",
236
+ "name": "cmd output",
237
+ "active": true,
238
+ "tosidebar": true,
239
+ "console": false,
240
+ "tostatus": false,
241
+ "complete": "true",
242
+ "targetType": "full",
243
+ "x": 920,
244
+ "y": 260,
245
+ "wires": []
246
+ },
247
+ {
248
+ "id": "debug-run",
249
+ "type": "debug",
250
+ "z": "flow-basecasts",
251
+ "name": "run output",
252
+ "active": true,
253
+ "tosidebar": true,
254
+ "console": false,
255
+ "tostatus": false,
256
+ "complete": "true",
257
+ "targetType": "full",
258
+ "x": 920,
259
+ "y": 360,
260
+ "wires": []
261
+ },
262
+ {
263
+ "id": "debug-events",
264
+ "type": "debug",
265
+ "z": "flow-basecasts",
266
+ "name": "event output",
267
+ "active": true,
268
+ "tosidebar": true,
269
+ "console": false,
270
+ "tostatus": false,
271
+ "complete": "true",
272
+ "targetType": "full",
273
+ "x": 920,
274
+ "y": 540,
275
+ "wires": []
276
+ }
277
+ ]