@zintrust/queue-cloudflare 2.4.2 → 2.4.3
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 +27 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,12 +24,17 @@ const queue = CloudflareQueues.create({
|
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
const job = await queue.add(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const job = await queue.add(
|
|
28
|
+
'email-queue',
|
|
29
|
+
'send-email',
|
|
30
|
+
{ to: 'user@example.com' },
|
|
31
|
+
{
|
|
32
|
+
attempts: 5,
|
|
33
|
+
backoff: { type: 'exponential', delay: 1000 },
|
|
34
|
+
priority: 2,
|
|
35
|
+
delay: 30000,
|
|
36
|
+
}
|
|
37
|
+
);
|
|
33
38
|
|
|
34
39
|
await queue.getJob('email-queue', job.id);
|
|
35
40
|
await queue.getJobCounts('email-queue', 'waiting', 'active', 'completed', 'failed');
|
|
@@ -40,18 +45,16 @@ Inside a Cloudflare Worker, bind the queue in `wrangler.jsonc`:
|
|
|
40
45
|
```jsonc
|
|
41
46
|
{
|
|
42
47
|
"queues": {
|
|
43
|
-
"producers": [
|
|
44
|
-
{ "queue": "email-queue", "binding": "EMAIL_QUEUE" }
|
|
45
|
-
],
|
|
48
|
+
"producers": [{ "queue": "email-queue", "binding": "EMAIL_QUEUE" }],
|
|
46
49
|
"consumers": [
|
|
47
50
|
{
|
|
48
51
|
"queue": "email-queue",
|
|
49
52
|
"max_batch_size": 10,
|
|
50
53
|
"max_retries": 3,
|
|
51
|
-
"dead_letter_queue": "email-dlq"
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
}
|
|
54
|
+
"dead_letter_queue": "email-dlq",
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
},
|
|
55
58
|
}
|
|
56
59
|
```
|
|
57
60
|
|
|
@@ -63,32 +66,32 @@ Add the state bindings when using BullMQ-like metadata:
|
|
|
63
66
|
{
|
|
64
67
|
"binding": "QUEUE_DB",
|
|
65
68
|
"database_name": "zintrust-queue",
|
|
66
|
-
"database_id": "<database-id>"
|
|
67
|
-
}
|
|
69
|
+
"database_id": "<database-id>",
|
|
70
|
+
},
|
|
68
71
|
],
|
|
69
72
|
"kv_namespaces": [
|
|
70
73
|
{
|
|
71
74
|
"binding": "QUEUE_KV",
|
|
72
|
-
"id": "<namespace-id>"
|
|
73
|
-
}
|
|
75
|
+
"id": "<namespace-id>",
|
|
76
|
+
},
|
|
74
77
|
],
|
|
75
78
|
"durable_objects": {
|
|
76
79
|
"bindings": [
|
|
77
80
|
{
|
|
78
81
|
"name": "QUEUE_COORDINATOR",
|
|
79
|
-
"class_name": "CloudflareQueueCoordinator"
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
+
"class_name": "CloudflareQueueCoordinator",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
82
85
|
},
|
|
83
86
|
"migrations": [
|
|
84
87
|
{
|
|
85
88
|
"tag": "queue-cloudflare-v1",
|
|
86
|
-
"new_sqlite_classes": ["CloudflareQueueCoordinator"]
|
|
87
|
-
}
|
|
89
|
+
"new_sqlite_classes": ["CloudflareQueueCoordinator"],
|
|
90
|
+
},
|
|
88
91
|
],
|
|
89
92
|
"triggers": {
|
|
90
|
-
"crons": ["* * * * *"]
|
|
91
|
-
}
|
|
93
|
+
"crons": ["* * * * *"],
|
|
94
|
+
},
|
|
92
95
|
}
|
|
93
96
|
```
|
|
94
97
|
|
|
@@ -153,6 +156,3 @@ Environment fallbacks:
|
|
|
153
156
|
- `CLOUDFLARE_API_BASE_URL`
|
|
154
157
|
|
|
155
158
|
The driver registers as both `cloudflare` and `cloudflare-queues`.
|
|
156
|
-
|
|
157
|
-
For the BullMQ-compatible state-layer roadmap, see
|
|
158
|
-
[BULLMQ_COMPATIBILITY_PLAN.md](./BULLMQ_COMPATIBILITY_PLAN.md).
|