@researchdatabox/agenda-sqs-backend 0.0.1-beta.9472
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 +51 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @researchdatabox/agenda-sqs-backend
|
|
2
|
+
|
|
3
|
+
Amazon SQS backend for `agenda`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @researchdatabox/agenda-sqs-backend
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { Agenda } from 'agenda';
|
|
15
|
+
import { SqsBackend } from '@researchdatabox/agenda-sqs-backend';
|
|
16
|
+
|
|
17
|
+
const agenda = new Agenda({
|
|
18
|
+
backend: new SqsBackend({
|
|
19
|
+
queueUrl: 'https://sqs.ap-southeast-2.amazonaws.com/123456789012/jobs',
|
|
20
|
+
region: 'ap-southeast-2'
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
agenda.define('send-email', async job => {
|
|
25
|
+
console.log(job.attrs.data);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
await agenda.start();
|
|
29
|
+
await agenda.now('send-email', { userId: 'u1' });
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Notes
|
|
33
|
+
|
|
34
|
+
- This backend is queue-only.
|
|
35
|
+
- It does not support recurring jobs, `every()`, unique jobs, or query-style job browsing.
|
|
36
|
+
- SQS scheduling is limited to 15 minutes of delay.
|
|
37
|
+
- Redrive and retries are handled by SQS visibility and your queue redrive policy.
|
|
38
|
+
- FIFO queues are supported when the queue URL ends with `.fifo` or FIFO is enabled in config.
|
|
39
|
+
|
|
40
|
+
## Configuration
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
new SqsBackend({
|
|
44
|
+
queueUrl,
|
|
45
|
+
region,
|
|
46
|
+
waitTimeSeconds: 20,
|
|
47
|
+
receiveBatchSize: 10,
|
|
48
|
+
visibilityTimeoutSeconds: 300,
|
|
49
|
+
unknownJobPolicy: 'release'
|
|
50
|
+
});
|
|
51
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@researchdatabox/agenda-sqs-backend",
|
|
3
|
+
"version": "0.0.1-beta.9472",
|
|
4
|
+
"description": "Amazon SQS backend for Agenda job scheduler",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18.0.0"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -b",
|
|
26
|
+
"typecheck": "tsc -b && tsc -p tsconfig.test.json",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@aws-sdk/client-sqs": "3.1043.0",
|
|
32
|
+
"debug": "4.4.3"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"agenda": "6.2.4"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@tsconfig/node24": "24.0.4",
|
|
39
|
+
"@types/debug": "4.1.13",
|
|
40
|
+
"@types/node": "24.12.0",
|
|
41
|
+
"agenda": "6.2.4",
|
|
42
|
+
"typescript": "5.9.3",
|
|
43
|
+
"vitest": "4.1.5"
|
|
44
|
+
}
|
|
45
|
+
}
|