@aponiajs/queue 0.0.0-stage → 1.0.0-beta.65
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 +275 -2
- package/dist/index.d.mts +427 -0
- package/dist/index.mjs +1001 -0
- package/llms.txt +38 -0
- package/package.json +57 -4
package/llms.txt
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @aponiajs/queue
|
|
2
|
+
|
|
3
|
+
> An in-process job queue and transactional outbox for an AponiaJS application, with bounded retries, exponential backoff, dead letters, and idempotent enqueue.
|
|
4
|
+
|
|
5
|
+
## What this package exports
|
|
6
|
+
|
|
7
|
+
- `QueueModule.forRoot({ queue?, outbox?, isGlobal?, name? })`: the module an application imports; `register({...})` is the deprecated alias and `forRootAsync` accepts the three Nest shapes.
|
|
8
|
+
- `MODULE_OPTIONS_TOKEN` (`QUEUE_MODULE_OPTIONS`): the options token the registration provides and exports.
|
|
9
|
+
- `Processor(nameOrOptions)`, `WorkerHost`, `InjectQueue(name?)`, `getQueueToken(name?)`: the BullMQ-shaped processor surface. The processor name is the job name it handles, and `getQueueToken` returns `AponiaQueue_<name>`; there is no broker worker or subscription.
|
|
10
|
+
- `JOB_REF`: a forwarding view of the job the current handler is running.
|
|
11
|
+
- `QueueService`: `registerHandler`, `enqueue`, `drain`, `waitForIdle`, `pending`, `deadLetters`, `retryDeadLetter`, `stats`, `flush`, `close`, `clear`.
|
|
12
|
+
- `MemoryQueueStore`: a bounded in-memory `QueueStore` for tests.
|
|
13
|
+
- `OutboxService`: `record`, `pending`, `flush`, `clear`.
|
|
14
|
+
- Types: `QueueJob`, `QueueHandler`, `QueueEnqueueOptions`, `QueueDrainSummary`, `QueueStats`, `QueueTimer`, `QueueStore`, `QueueServiceOptions`, `QueueModuleOptions`, `OutboxMessage`, `OutboxSink`, `OutboxOptions`, `OutboxFlushResult`.
|
|
15
|
+
|
|
16
|
+
## Behavior a consumer can rely on
|
|
17
|
+
|
|
18
|
+
- `enqueue` returns a frozen job snapshot with a generated id and the attempt budget it will use.
|
|
19
|
+
- The registration validates both option groups eagerly and reports every invalid bound or malformed store as `INVALID_QUEUE_OPTIONS`.
|
|
20
|
+
- `pause`/`resume` stop and restart automatic draining; `paused` reports the state, and an explicit `drain` still runs while paused.
|
|
21
|
+
- `priority` orders due jobs, highest first; equal priorities keep enqueue order.
|
|
22
|
+
- `jobTimeoutMs`/`timeoutMs` bound one attempt; an overrun is a failure (`QUEUE_JOB_TIMEOUT`) that retries or dead-letters normally.
|
|
23
|
+
- The handler receives `(payload, job, signal)`; the signal aborts on timeout and on close, cooperatively.
|
|
24
|
+
- A failed attempt retries with exponential backoff; a job that exhausts its budget moves to the dead letter queue.
|
|
25
|
+
- Dead letters are bounded by `maxDeadLetters` (defaults to `maxJobs`); the oldest is evicted when full.
|
|
26
|
+
- A handler runs outside every registered request-context store; read the caller and tenant from the payload.
|
|
27
|
+
- `onModuleDestroy` drains due jobs, aborts in-flight work, and flushes tracked writes.
|
|
28
|
+
- `idempotencyKey` deduplicates an enqueue while that job is pending or running; a completed job forgets its key.
|
|
29
|
+
- `drain` runs due jobs in batches of `concurrency` and answers completed, retried, and dead-lettered counts.
|
|
30
|
+
- `waitForIdle` resolves when nothing is running and no pending job is due now.
|
|
31
|
+
- `store` hydrates pending and dead-lettered jobs at module initialization; `flush` awaits the writes the store accepted and rethrows the first failure.
|
|
32
|
+
- `flush` delivers outbox messages in order and keeps the rejected one for the next flush; `flush(sink, { signal })` stops between messages and leaves the tail.
|
|
33
|
+
- Without a store the backlog is process-local; a supplied store survives a restart but is not a broker, so one consumer owns one backlog. The outbox remains process-local.
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
- [Package README](./README.md)
|
|
38
|
+
- [Agent surface](../../docs/agent/README.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aponiajs/queue",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0-beta.65",
|
|
4
|
+
"description": "An in-process job queue and transactional outbox for an Aponia application, with retries, backoff, dead letters, and idempotent enqueue.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"aponia",
|
|
7
|
+
"aponiajs",
|
|
8
|
+
"bun",
|
|
9
|
+
"elysia",
|
|
10
|
+
"jobs",
|
|
11
|
+
"outbox",
|
|
12
|
+
"queue",
|
|
13
|
+
"worker"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/aponiajs/aponiajs#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/aponiajs/aponiajs/issues"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "AponiaJS contributors",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/aponiajs/aponiajs.git",
|
|
24
|
+
"directory": "packages/queue"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"llms.txt"
|
|
29
|
+
],
|
|
30
|
+
"type": "module",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": "./dist/index.mjs",
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "bunx --bun vp pack",
|
|
40
|
+
"dev": "bunx --bun vp pack --watch",
|
|
41
|
+
"test": "bun test",
|
|
42
|
+
"test:vite-plus": "vp test",
|
|
43
|
+
"check": "bunx --bun vp check",
|
|
44
|
+
"prepublishOnly": "bun run build"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@aponiajs/common": "1.0.0-beta.65",
|
|
48
|
+
"@aponiajs/compiler": "1.0.0-beta.65"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@aponiajs/core": "1.0.0-beta.65",
|
|
52
|
+
"@aponiajs/platform-elysia": "1.0.0-beta.65",
|
|
53
|
+
"@aponiajs/testing": "1.0.0-beta.65",
|
|
54
|
+
"elysia": "2.0.0-rc.4"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"bun": ">=1.4.4"
|
|
58
|
+
}
|
|
59
|
+
}
|