@nwire/queue 0.9.1 → 0.10.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 +47 -31
- package/dist/queue-inmemory.d.ts +31 -0
- package/dist/queue-inmemory.js +107 -0
- package/dist/queue-interface.d.ts +1 -2
- package/dist/queue-interface.js +0 -1
- package/dist/queue-transport.d.ts +0 -1
- package/dist/queue-transport.js +0 -1
- package/dist/queue-worker.d.ts +1 -2
- package/dist/queue-worker.js +1 -2
- package/dist/queue.d.ts +2 -3
- package/dist/queue.js +3 -3
- package/package.json +9 -7
- package/dist/__tests__/cancellation.test.d.ts +0 -8
- package/dist/__tests__/cancellation.test.d.ts.map +0 -1
- package/dist/__tests__/cancellation.test.js +0 -147
- package/dist/__tests__/cancellation.test.js.map +0 -1
- package/dist/__tests__/queue.test.d.ts +0 -9
- package/dist/__tests__/queue.test.d.ts.map +0 -1
- package/dist/__tests__/queue.test.js +0 -137
- package/dist/__tests__/queue.test.js.map +0 -1
- package/dist/queue-interface.d.ts.map +0 -1
- package/dist/queue-interface.js.map +0 -1
- package/dist/queue-transport.d.ts.map +0 -1
- package/dist/queue-transport.js.map +0 -1
- package/dist/queue-worker.d.ts.map +0 -1
- package/dist/queue-worker.js.map +0 -1
- package/dist/queue.d.ts.map +0 -1
- package/dist/queue.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,56 +1,72 @@
|
|
|
1
1
|
# @nwire/queue
|
|
2
2
|
|
|
3
|
-
> Background-job transport —
|
|
3
|
+
> Background-job transport — contract + in-memory default + adopter.
|
|
4
|
+
> Use directly in dev/tests; swap to `@nwire/bullmq` for production.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
```bash
|
|
7
|
+
pnpm add @nwire/queue
|
|
8
|
+
```
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
## As an adopter
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
The 0.10 way: `queueInMemory()` returns an `Adapter` that consumes wires
|
|
13
|
+
whose `binding.$adapter === "queue"`. Stack it on the same endpoint as
|
|
14
|
+
`httpKoa` so a single app serves HTTP + queue with the same handlers.
|
|
10
15
|
|
|
11
|
-
```
|
|
12
|
-
|
|
16
|
+
```ts
|
|
17
|
+
import { createApp } from "@nwire/app";
|
|
18
|
+
import { endpoint } from "@nwire/endpoint";
|
|
19
|
+
import { queue } from "@nwire/wires/queue";
|
|
20
|
+
import { httpKoa } from "@nwire/koa";
|
|
21
|
+
import { queueInMemory } from "@nwire/queue";
|
|
22
|
+
|
|
23
|
+
const app = createApp({ appName: "svc" });
|
|
24
|
+
app.wire(queue("emails.send"), async (input) => { /* send mail */ });
|
|
25
|
+
|
|
26
|
+
const q = queueInMemory();
|
|
27
|
+
await endpoint("svc", { port: 3000 })
|
|
28
|
+
.use(httpKoa())
|
|
29
|
+
.use(q)
|
|
30
|
+
.mount(app)
|
|
31
|
+
.run();
|
|
32
|
+
|
|
33
|
+
await q.enqueue("emails.send", { userId: "u-1" });
|
|
34
|
+
// queue subscriber dispatches the wire's handler.
|
|
13
35
|
```
|
|
14
36
|
|
|
15
|
-
##
|
|
37
|
+
## Low-level contract
|
|
38
|
+
|
|
39
|
+
For embedding in tests or building custom adapters, the underlying
|
|
40
|
+
`QueueTransport` interface ships unchanged:
|
|
16
41
|
|
|
17
42
|
```ts
|
|
18
|
-
import {
|
|
43
|
+
import {
|
|
44
|
+
InMemoryQueueTransport,
|
|
45
|
+
createQueueWorker,
|
|
46
|
+
type QueueTransport,
|
|
47
|
+
} from "@nwire/queue";
|
|
19
48
|
|
|
20
49
|
const transport = new InMemoryQueueTransport();
|
|
21
|
-
|
|
22
50
|
const worker = createQueueWorker(app, transport, {
|
|
23
51
|
subscribe: [
|
|
24
52
|
{ queue: "emails", action: "sendWelcomeEmail" },
|
|
25
53
|
{ queue: "reports", action: "generateMonthlyReport", retry: { attempts: 3 } },
|
|
26
54
|
],
|
|
27
55
|
});
|
|
28
|
-
|
|
29
56
|
await transport.enqueue("emails", { userId: "u-1" });
|
|
30
57
|
await worker.start();
|
|
31
|
-
// worker pulls from "emails" → dispatches sendWelcomeEmail with the payload
|
|
32
58
|
```
|
|
33
59
|
|
|
34
|
-
##
|
|
35
|
-
|
|
36
|
-
- `QueueTransport` — interface adapters implement.
|
|
37
|
-
- `InMemoryQueueTransport` — process-local default; `delayMs`-aware.
|
|
38
|
-
- `createQueueWorker(app, transport, opts)` — bind queues to actions.
|
|
39
|
-
- `QueueMessage` / `QueueConsumer` / `QueueWorker` / `QueueSubscription` / `CreateQueueWorkerOptions` — supporting types.
|
|
40
|
-
|
|
41
|
-
## When to use
|
|
42
|
-
|
|
43
|
-
Whenever a request shouldn't block the caller — sending emails, building reports, syncing to a third party. Same handler shape as an HTTP action, so behavior is identical across transports.
|
|
60
|
+
## Surface
|
|
44
61
|
|
|
45
|
-
|
|
62
|
+
- `queueInMemory(config?)` — 0.10 adopter
|
|
63
|
+
- `QueueTransport` — pluggable contract (in-memory, BullMQ, SQS, …)
|
|
64
|
+
- `InMemoryQueueTransport` — process-local default; `delayMs`-aware
|
|
65
|
+
- `createQueueWorker(app, transport, opts)` — bind queues to actions
|
|
66
|
+
- `queueInterface()` — typed binding factory (`queue("emails.send")`)
|
|
46
67
|
|
|
47
|
-
|
|
68
|
+
## Related
|
|
48
69
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const app = createApp({
|
|
53
|
-
/* ...config... */
|
|
54
|
-
});
|
|
55
|
-
// Adapter/plugin wiring happens here when applicable.
|
|
56
|
-
```
|
|
70
|
+
- [`@nwire/bullmq`](../nwire-bullmq) — production queue adapter (Redis)
|
|
71
|
+
- [`@nwire/wires`](../core-wires) — `queue()` binding helper
|
|
72
|
+
- [`@nwire/endpoint`](../core-endpoint) — adopter lifecycle host
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@nwire/queue` — in-memory queue adopter.
|
|
3
|
+
*
|
|
4
|
+
* endpoint("svc", { port: 3000 })
|
|
5
|
+
* .use(httpKoa())
|
|
6
|
+
* .use(queueInMemory())
|
|
7
|
+
* .mount(app)
|
|
8
|
+
* .run();
|
|
9
|
+
*
|
|
10
|
+
* Consumes wires whose `binding.$adapter === "queue"`. Each wire is
|
|
11
|
+
* subscribed to the queue named by its binding; messages dispatched via
|
|
12
|
+
* `adapter.enqueue(queueName, payload)` route to the matching wire's
|
|
13
|
+
* handler.
|
|
14
|
+
*
|
|
15
|
+
* Useful for tests and single-process demos. Production swaps for
|
|
16
|
+
* `@nwire/bullmq` or `@nwire/queue-redis` against the same
|
|
17
|
+
* Adapter contract.
|
|
18
|
+
*/
|
|
19
|
+
import type { Adapter } from "@nwire/endpoint";
|
|
20
|
+
import { type Logger } from "@nwire/logger";
|
|
21
|
+
import { type MessageEnvelope } from "@nwire/envelope";
|
|
22
|
+
export interface QueueInMemoryConfig {
|
|
23
|
+
readonly logger?: Logger;
|
|
24
|
+
}
|
|
25
|
+
export interface QueueInMemoryAdapter extends Adapter {
|
|
26
|
+
/** Enqueue a payload onto a named queue. Subscribers dispatch the wire's handler. */
|
|
27
|
+
enqueue(queueName: string, input: unknown, envelope?: MessageEnvelope): Promise<void>;
|
|
28
|
+
/** True after boot if at least one wire is subscribed. */
|
|
29
|
+
isRunning(): boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare function queueInMemory(config?: QueueInMemoryConfig): QueueInMemoryAdapter;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@nwire/queue` — in-memory queue adopter.
|
|
3
|
+
*
|
|
4
|
+
* endpoint("svc", { port: 3000 })
|
|
5
|
+
* .use(httpKoa())
|
|
6
|
+
* .use(queueInMemory())
|
|
7
|
+
* .mount(app)
|
|
8
|
+
* .run();
|
|
9
|
+
*
|
|
10
|
+
* Consumes wires whose `binding.$adapter === "queue"`. Each wire is
|
|
11
|
+
* subscribed to the queue named by its binding; messages dispatched via
|
|
12
|
+
* `adapter.enqueue(queueName, payload)` route to the matching wire's
|
|
13
|
+
* handler.
|
|
14
|
+
*
|
|
15
|
+
* Useful for tests and single-process demos. Production swaps for
|
|
16
|
+
* `@nwire/bullmq` or `@nwire/queue-redis` against the same
|
|
17
|
+
* Adapter contract.
|
|
18
|
+
*/
|
|
19
|
+
import { dummyContainer } from "@nwire/container";
|
|
20
|
+
import { ConsoleLogger } from "@nwire/logger";
|
|
21
|
+
import { seedEnvelope } from "@nwire/envelope";
|
|
22
|
+
function isQueueBinding(b) {
|
|
23
|
+
return (typeof b === "object" &&
|
|
24
|
+
b !== null &&
|
|
25
|
+
b.$adapter === "queue" &&
|
|
26
|
+
typeof b.queue === "string");
|
|
27
|
+
}
|
|
28
|
+
export function queueInMemory(config = {}) {
|
|
29
|
+
const logger = config.logger ?? new ConsoleLogger();
|
|
30
|
+
const subscribers = new Map();
|
|
31
|
+
let running = false;
|
|
32
|
+
let stopping = false;
|
|
33
|
+
return {
|
|
34
|
+
$kind: "adapter",
|
|
35
|
+
kind: "queue",
|
|
36
|
+
isRunning() {
|
|
37
|
+
return running;
|
|
38
|
+
},
|
|
39
|
+
async boot(ctx) {
|
|
40
|
+
for (const wire of ctx.wires) {
|
|
41
|
+
if (!isQueueBinding(wire.binding))
|
|
42
|
+
continue;
|
|
43
|
+
const list = subscribers.get(wire.binding.queue) ?? [];
|
|
44
|
+
list.push({ wire, containerOf: ctx.containerOf });
|
|
45
|
+
subscribers.set(wire.binding.queue, list);
|
|
46
|
+
}
|
|
47
|
+
running = subscribers.size > 0;
|
|
48
|
+
ctx.addCheck({ name: "queue-inmemory", check: () => undefined });
|
|
49
|
+
},
|
|
50
|
+
async shutdown() {
|
|
51
|
+
stopping = true;
|
|
52
|
+
subscribers.clear();
|
|
53
|
+
running = false;
|
|
54
|
+
void stopping;
|
|
55
|
+
},
|
|
56
|
+
async enqueue(queueName, input, envelope) {
|
|
57
|
+
const list = subscribers.get(queueName) ?? [];
|
|
58
|
+
if (list.length === 0) {
|
|
59
|
+
logger.warn?.(`[queue-inmemory] no subscriber for queue "${queueName}" — message dropped`, undefined);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
// Dispatch each subscriber in parallel; errors are logged but don't
|
|
63
|
+
// abort siblings (matches typical queue semantics: jobs are
|
|
64
|
+
// independent).
|
|
65
|
+
await Promise.all(list.map(async ({ wire, containerOf }) => {
|
|
66
|
+
try {
|
|
67
|
+
await dispatchToWire(wire, input, envelope, containerOf, logger);
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
logger.error?.(`[queue-inmemory] handler for "${queueName}" threw: ${err.message}`, undefined);
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
async function dispatchToWire(wire, input, envelope, containerOf, logger) {
|
|
77
|
+
const env = envelope ?? seedEnvelope({});
|
|
78
|
+
const parentContainer = containerOf(wire) ?? dummyContainer();
|
|
79
|
+
const scope = parentContainer.createScope();
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
+
const wireApp = wire.app;
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
+
const runtimeExecute = wireApp?.runtime?.execute;
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
|
+
const hasRunMethod = typeof wire.handler?.run === "function";
|
|
86
|
+
try {
|
|
87
|
+
if (runtimeExecute && hasRunMethod) {
|
|
88
|
+
await runtimeExecute.call(wireApp.runtime, wire.handler, input, {
|
|
89
|
+
tenant: env.tenant,
|
|
90
|
+
userId: env.userId,
|
|
91
|
+
correlationId: env.correlationId,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
|
+
const fn = wire.handler.run ?? wire.handler;
|
|
97
|
+
await fn(input, {
|
|
98
|
+
resolve: (name) => scope.resolve(name),
|
|
99
|
+
logger,
|
|
100
|
+
envelope: env,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
await scope.dispose();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `queueInterface()` — NwireServable queue transport for `endpoint().serve()`.
|
|
3
3
|
*/
|
|
4
|
-
import type { App } from "@nwire/forge";
|
|
4
|
+
import type { ForgeApp as App } from "@nwire/forge";
|
|
5
5
|
import type { NwireServable } from "@nwire/endpoint";
|
|
6
6
|
import type { QueueTransport } from "./queue-transport.js";
|
|
7
7
|
import { type CreateQueueWorkerOptions, type QueueWorker } from "./queue-worker.js";
|
|
@@ -12,4 +12,3 @@ export interface QueueInterface extends NwireServable {
|
|
|
12
12
|
stop(): Promise<void>;
|
|
13
13
|
}
|
|
14
14
|
export declare function queueInterface(app: App, transport: QueueTransport, options: CreateQueueWorkerOptions): QueueInterface;
|
|
15
|
-
//# sourceMappingURL=queue-interface.d.ts.map
|
package/dist/queue-interface.js
CHANGED
package/dist/queue-transport.js
CHANGED
package/dist/queue-worker.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import type * as forge from "@nwire/forge";
|
|
28
28
|
import type { QueueTransport } from "./queue-transport.js";
|
|
29
|
-
type App = forge.
|
|
29
|
+
type App = forge.ForgeApp;
|
|
30
30
|
type ActionDefinition = forge.ActionDefinition;
|
|
31
31
|
export interface QueueSubscription {
|
|
32
32
|
/** Queue name to subscribe to. Convention: `<domain>.<verb-noun>`. */
|
|
@@ -85,4 +85,3 @@ export interface QueueWorker {
|
|
|
85
85
|
}
|
|
86
86
|
export declare function createQueueWorker(app: App, transport: QueueTransport, options: CreateQueueWorkerOptions): QueueWorker;
|
|
87
87
|
export {};
|
|
88
|
-
//# sourceMappingURL=queue-worker.d.ts.map
|
package/dist/queue-worker.js
CHANGED
|
@@ -66,7 +66,7 @@ export function createQueueWorker(app, transport, options) {
|
|
|
66
66
|
// Combine worker-stop + per-job signals so the handler
|
|
67
67
|
// sees an abort if EITHER source fires.
|
|
68
68
|
const combined = combineSignals(workerController.signal, jobSignal);
|
|
69
|
-
await app.
|
|
69
|
+
await app.dispatch(subscription.action, msg.input, msg.envelope, {
|
|
70
70
|
signal: combined,
|
|
71
71
|
});
|
|
72
72
|
});
|
|
@@ -107,4 +107,3 @@ function combineSignals(a, b) {
|
|
|
107
107
|
b.addEventListener("abort", onAbort, { once: true });
|
|
108
108
|
return controller.signal;
|
|
109
109
|
}
|
|
110
|
-
//# sourceMappingURL=queue-worker.js.map
|
package/dist/queue.d.ts
CHANGED
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
* InMemoryQueueTransport — process-local, honors delayMs via setTimeout
|
|
6
6
|
* createQueueWorker(app, transport, { subscribe }) — bind queue → action
|
|
7
7
|
*
|
|
8
|
-
* Production deployments use a persistent adapter like `@nwire/
|
|
8
|
+
* Production deployments use a persistent adapter like `@nwire/bullmq`
|
|
9
9
|
* (Redis) or `@nwire/queue-sqs` (AWS). Same interface; swap by config.
|
|
10
10
|
*/
|
|
11
11
|
export { InMemoryQueueTransport, type QueueTransport, type QueueMessage, type QueueConsumer, } from "./queue-transport.js";
|
|
12
12
|
export { createQueueWorker, subscription, type QueueWorker, type QueueSubscription, type FluentQueueSubscription, type CreateQueueWorkerOptions, } from "./queue-worker.js";
|
|
13
|
-
export {
|
|
14
|
-
//# sourceMappingURL=queue.d.ts.map
|
|
13
|
+
export { queueInMemory, type QueueInMemoryConfig } from "./queue-inmemory.js";
|
package/dist/queue.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* InMemoryQueueTransport — process-local, honors delayMs via setTimeout
|
|
6
6
|
* createQueueWorker(app, transport, { subscribe }) — bind queue → action
|
|
7
7
|
*
|
|
8
|
-
* Production deployments use a persistent adapter like `@nwire/
|
|
8
|
+
* Production deployments use a persistent adapter like `@nwire/bullmq`
|
|
9
9
|
* (Redis) or `@nwire/queue-sqs` (AWS). Same interface; swap by config.
|
|
10
10
|
*/
|
|
11
11
|
export { InMemoryQueueTransport, } from "./queue-transport.js";
|
|
12
12
|
export { createQueueWorker, subscription, } from "./queue-worker.js";
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// Adopter shape — consumed by endpoint().use(queueInMemory()).mount(app).
|
|
14
|
+
export { queueInMemory } from "./queue-inmemory.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nwire/queue",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Nwire — queue transport contract + InMemory default + createQueueWorker. Production adapters land as @nwire/
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "Nwire — queue transport contract + InMemory default + createQueueWorker. Production adapters land as @nwire/bullmq, @nwire/queue-sqs, @nwire/queue-pgboss.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bus",
|
|
7
7
|
"nwire",
|
|
@@ -28,17 +28,19 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nwire/
|
|
32
|
-
"@nwire/
|
|
33
|
-
"@nwire/
|
|
34
|
-
"@nwire/
|
|
31
|
+
"@nwire/wires": "0.10.0",
|
|
32
|
+
"@nwire/forge": "0.10.0",
|
|
33
|
+
"@nwire/container": "0.10.0",
|
|
34
|
+
"@nwire/envelope": "0.10.0",
|
|
35
|
+
"@nwire/endpoint": "0.10.0",
|
|
36
|
+
"@nwire/logger": "0.10.0"
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
39
|
"@types/node": "^22.19.9",
|
|
38
40
|
"typescript": "^5.9.3",
|
|
39
41
|
"vitest": "^4.0.18",
|
|
40
42
|
"zod": "^4.0.0",
|
|
41
|
-
"@nwire/messages": "0.
|
|
43
|
+
"@nwire/messages": "0.10.0"
|
|
42
44
|
},
|
|
43
45
|
"scripts": {
|
|
44
46
|
"build": "tsc && node ../../scripts/fix-dist-extensions.mjs dist",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Queue worker cancellation — `worker.stop()` flips an internal
|
|
3
|
-
* AbortController so in-flight handlers observing `ctx.signal` can
|
|
4
|
-
* bail before drain finishes. The combine path covers a transport
|
|
5
|
-
* that supplies its own per-job signal (BullMQ lock expiry, etc.).
|
|
6
|
-
*/
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=cancellation.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cancellation.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/cancellation.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Queue worker cancellation — `worker.stop()` flips an internal
|
|
3
|
-
* AbortController so in-flight handlers observing `ctx.signal` can
|
|
4
|
-
* bail before drain finishes. The combine path covers a transport
|
|
5
|
-
* that supplies its own per-job signal (BullMQ lock expiry, etc.).
|
|
6
|
-
*/
|
|
7
|
-
import { describe, it, expect } from "vitest";
|
|
8
|
-
import { z } from "zod";
|
|
9
|
-
import { defineEvent } from "@nwire/messages";
|
|
10
|
-
import * as forge from "@nwire/forge";
|
|
11
|
-
import { seedEnvelope } from "@nwire/envelope";
|
|
12
|
-
import { InMemoryQueueTransport, createQueueWorker } from "../queue.js";
|
|
13
|
-
const { defineAction, defineActor, defineHandler, defineModule, eventFactory, createApp } = forge;
|
|
14
|
-
const SlowedEventDef = defineEvent({
|
|
15
|
-
name: "demo.slowed",
|
|
16
|
-
schema: z.object({ id: z.string() }),
|
|
17
|
-
});
|
|
18
|
-
const Slowed = eventFactory(SlowedEventDef);
|
|
19
|
-
const SlowActor = defineActor("slow", {
|
|
20
|
-
schema: z.object({ id: z.string(), count: z.number().optional() }),
|
|
21
|
-
key: "id",
|
|
22
|
-
initial: "idle",
|
|
23
|
-
states: {
|
|
24
|
-
idle: {
|
|
25
|
-
on: {
|
|
26
|
-
[SlowedEventDef.name]: {
|
|
27
|
-
assign: (ctx, event) => {
|
|
28
|
-
const c = ctx;
|
|
29
|
-
const e = event;
|
|
30
|
-
return { id: e.id, count: (c.count ?? 0) + 1 };
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
const slow = defineAction({
|
|
38
|
-
name: "demo.slow",
|
|
39
|
-
schema: z.object({ id: z.string(), ms: z.number() }),
|
|
40
|
-
});
|
|
41
|
-
describe("queue worker — cancellation via worker.stop()", () => {
|
|
42
|
-
it("aborts ctx.signal of in-flight handlers when worker.stop() is called", async () => {
|
|
43
|
-
let observedAbort = false;
|
|
44
|
-
let handlerStarted = false;
|
|
45
|
-
let resolveStarted = () => { };
|
|
46
|
-
const started = new Promise((r) => {
|
|
47
|
-
resolveStarted = r;
|
|
48
|
-
});
|
|
49
|
-
const slowHandler = defineHandler(slow, async (input, ctx) => {
|
|
50
|
-
handlerStarted = true;
|
|
51
|
-
resolveStarted();
|
|
52
|
-
await new Promise((resolve, reject) => {
|
|
53
|
-
const t = setTimeout(resolve, input.ms);
|
|
54
|
-
ctx.signal.addEventListener("abort", () => {
|
|
55
|
-
clearTimeout(t);
|
|
56
|
-
observedAbort = true;
|
|
57
|
-
reject(new Error("aborted"));
|
|
58
|
-
}, { once: true });
|
|
59
|
-
});
|
|
60
|
-
return Slowed({ id: input.id });
|
|
61
|
-
});
|
|
62
|
-
const demoModule = defineModule("demo", {
|
|
63
|
-
actions: [slow],
|
|
64
|
-
actors: [SlowActor],
|
|
65
|
-
handlers: [slowHandler],
|
|
66
|
-
events: [SlowedEventDef],
|
|
67
|
-
});
|
|
68
|
-
const app = createApp({ modules: [demoModule] });
|
|
69
|
-
const transport = new InMemoryQueueTransport();
|
|
70
|
-
const worker = createQueueWorker(app, transport, {
|
|
71
|
-
subscribe: [{ queue: "demo.slow", action: slow }],
|
|
72
|
-
});
|
|
73
|
-
await app.start();
|
|
74
|
-
await worker.start();
|
|
75
|
-
// Fire-and-forget the enqueue — the in-memory transport awaits its
|
|
76
|
-
// consumer, but the consumer awaits the handler which awaits the
|
|
77
|
-
// signal. We don't await this; we'll abort it via worker.stop().
|
|
78
|
-
const enqueued = transport
|
|
79
|
-
.enqueue("demo.slow", {
|
|
80
|
-
input: { id: "s-1", ms: 5000 },
|
|
81
|
-
envelope: seedEnvelope({}),
|
|
82
|
-
})
|
|
83
|
-
.catch(() => undefined);
|
|
84
|
-
await started;
|
|
85
|
-
expect(handlerStarted).toBe(true);
|
|
86
|
-
await worker.stop();
|
|
87
|
-
await enqueued;
|
|
88
|
-
expect(observedAbort).toBe(true);
|
|
89
|
-
});
|
|
90
|
-
it("combines worker-stop signal with a transport-supplied job signal (BullMQ shape)", async () => {
|
|
91
|
-
// Hand-rolled transport that supplies its own per-job signal — this
|
|
92
|
-
// mirrors what a BullMQ adapter does when wiring the job lock.
|
|
93
|
-
let observedAbort = false;
|
|
94
|
-
let resolveStarted = () => { };
|
|
95
|
-
const started = new Promise((r) => {
|
|
96
|
-
resolveStarted = r;
|
|
97
|
-
});
|
|
98
|
-
const jobController = new AbortController();
|
|
99
|
-
const fakeTransport = {
|
|
100
|
-
enqueue: async () => undefined,
|
|
101
|
-
stop: async () => undefined,
|
|
102
|
-
subscribe(_queue, consumer) {
|
|
103
|
-
// Simulate transport delivering one message with its own signal.
|
|
104
|
-
const msg = {
|
|
105
|
-
queue: "demo.slow",
|
|
106
|
-
input: { id: "j-1", ms: 5000 },
|
|
107
|
-
envelope: seedEnvelope({}),
|
|
108
|
-
};
|
|
109
|
-
// Don't await — we want to abort it mid-flight via jobController.
|
|
110
|
-
// The error is swallowed by the transport in real life; we mirror that.
|
|
111
|
-
void consumer(msg, jobController.signal).catch(() => undefined);
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
const slowHandler = defineHandler(slow, async (input, ctx) => {
|
|
115
|
-
resolveStarted();
|
|
116
|
-
await new Promise((resolve, reject) => {
|
|
117
|
-
const t = setTimeout(resolve, input.ms);
|
|
118
|
-
ctx.signal.addEventListener("abort", () => {
|
|
119
|
-
clearTimeout(t);
|
|
120
|
-
observedAbort = true;
|
|
121
|
-
reject(new Error("aborted"));
|
|
122
|
-
}, { once: true });
|
|
123
|
-
});
|
|
124
|
-
return Slowed({ id: input.id });
|
|
125
|
-
});
|
|
126
|
-
const demoModule = defineModule("demo", {
|
|
127
|
-
actions: [slow],
|
|
128
|
-
actors: [SlowActor],
|
|
129
|
-
handlers: [slowHandler],
|
|
130
|
-
events: [SlowedEventDef],
|
|
131
|
-
});
|
|
132
|
-
const app = createApp({ modules: [demoModule] });
|
|
133
|
-
const worker = createQueueWorker(app, fakeTransport, {
|
|
134
|
-
subscribe: [{ queue: "demo.slow", action: slow }],
|
|
135
|
-
});
|
|
136
|
-
await app.start();
|
|
137
|
-
await worker.start();
|
|
138
|
-
await started;
|
|
139
|
-
// Fire the job-side signal (lock expired / job removed). Worker is
|
|
140
|
-
// still running.
|
|
141
|
-
jobController.abort();
|
|
142
|
-
await new Promise((r) => setTimeout(r, 30));
|
|
143
|
-
expect(observedAbort).toBe(true);
|
|
144
|
-
await worker.stop();
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
//# sourceMappingURL=cancellation.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cancellation.test.js","sourceRoot":"","sources":["../../src/__tests__/cancellation.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,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AK,CAAC,EAAE,EAAE,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,EAAE;YACtC,OAAO,EAAE,CAAC,IAAI,CAAC;YACf,MAAM,EAAE,CAAC,SAAS,CAAC;YACnB,QAAQ,EAAE,CAAC,WAAW,CAAC;YACvB,MAAM,EAAE,CAAC,cAAc,CAAC;SACzB,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,aAAa,EAAE;YACnD,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;SAClD,CAAC,CAAC;QACH,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QAErB,MAAM,OAAO,CAAC;QACd,mEAAmE;QACnE,iBAAiB;QACjB,aAAa,CAAC,KAAK,EAAE,CAAC;QACtB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAE5C,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Queue worker — contract test. Producer enqueues a message; consumer
|
|
3
|
-
* dispatches the bound action; actor state reflects the message's effect.
|
|
4
|
-
*
|
|
5
|
-
* Wire-mode invariance proof: the same handler+actor that the HTTP wire uses
|
|
6
|
-
* runs identically when triggered through a queue. Domain code unchanged.
|
|
7
|
-
*/
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=queue.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/queue.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Queue worker — contract test. Producer enqueues a message; consumer
|
|
3
|
-
* dispatches the bound action; actor state reflects the message's effect.
|
|
4
|
-
*
|
|
5
|
-
* Wire-mode invariance proof: the same handler+actor that the HTTP wire uses
|
|
6
|
-
* runs identically when triggered through a queue. Domain code unchanged.
|
|
7
|
-
*/
|
|
8
|
-
import { describe, it, expect } from "vitest";
|
|
9
|
-
import { z } from "zod";
|
|
10
|
-
import { defineEvent } from "@nwire/messages";
|
|
11
|
-
import * as forge from "@nwire/forge";
|
|
12
|
-
import { seedEnvelope } from "@nwire/envelope";
|
|
13
|
-
import { InMemoryQueueTransport, createQueueWorker, subscription } from "../queue.js";
|
|
14
|
-
const { defineAction, defineActor, defineHandler, defineModule, eventFactory, createApp } = forge;
|
|
15
|
-
const PingedEventDef = defineEvent({
|
|
16
|
-
name: "demo.pinged",
|
|
17
|
-
schema: z.object({ pingId: z.string() }),
|
|
18
|
-
});
|
|
19
|
-
const Pinged = eventFactory(PingedEventDef);
|
|
20
|
-
const PingActor = defineActor("ping", {
|
|
21
|
-
schema: z.object({ pingId: z.string(), pings: z.number().optional() }),
|
|
22
|
-
key: "pingId",
|
|
23
|
-
initial: "idle",
|
|
24
|
-
states: {
|
|
25
|
-
idle: {
|
|
26
|
-
on: {
|
|
27
|
-
[PingedEventDef.name]: {
|
|
28
|
-
assign: (ctx, event) => {
|
|
29
|
-
const c = ctx;
|
|
30
|
-
const e = event;
|
|
31
|
-
return { pingId: e.pingId, pings: (c.pings ?? 0) + 1 };
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
const ping = defineAction({ name: "demo.ping", schema: z.object({ pingId: z.string() }) });
|
|
39
|
-
const pingHandler = defineHandler(ping, async (input) => Pinged({ pingId: input.pingId }));
|
|
40
|
-
const demoModule = defineModule("demo", {
|
|
41
|
-
actions: [ping],
|
|
42
|
-
actors: [PingActor],
|
|
43
|
-
handlers: [pingHandler],
|
|
44
|
-
events: [PingedEventDef],
|
|
45
|
-
});
|
|
46
|
-
describe("queue worker — InMemoryQueueTransport drives actions through the runtime", () => {
|
|
47
|
-
it("an enqueued message dispatches the bound action and updates the actor", async () => {
|
|
48
|
-
const app = createApp({ modules: [demoModule] });
|
|
49
|
-
const transport = new InMemoryQueueTransport();
|
|
50
|
-
const worker = createQueueWorker(app, transport, {
|
|
51
|
-
subscribe: [{ queue: "demo.ping", action: ping }],
|
|
52
|
-
});
|
|
53
|
-
await app.start();
|
|
54
|
-
await worker.start();
|
|
55
|
-
await transport.enqueue("demo.ping", {
|
|
56
|
-
input: { pingId: "p-1" },
|
|
57
|
-
envelope: seedEnvelope({}),
|
|
58
|
-
});
|
|
59
|
-
const stored = await app.runtime.getActorStore().load("ping", "p-1");
|
|
60
|
-
expect(stored).not.toBeNull();
|
|
61
|
-
expect((stored?.data).pings).toBe(1);
|
|
62
|
-
await worker.stop();
|
|
63
|
-
});
|
|
64
|
-
it("queue messages carry their tenant — actor state stays in that tenant's scope", async () => {
|
|
65
|
-
const app = createApp({ modules: [demoModule] });
|
|
66
|
-
const transport = new InMemoryQueueTransport();
|
|
67
|
-
const worker = createQueueWorker(app, transport, {
|
|
68
|
-
subscribe: [{ queue: "demo.ping", action: ping }],
|
|
69
|
-
});
|
|
70
|
-
await worker.start();
|
|
71
|
-
await transport.enqueue("demo.ping", {
|
|
72
|
-
input: { pingId: "p-2" },
|
|
73
|
-
envelope: seedEnvelope({ tenant: "school-tlv" }),
|
|
74
|
-
});
|
|
75
|
-
await transport.enqueue("demo.ping", {
|
|
76
|
-
input: { pingId: "p-2" },
|
|
77
|
-
envelope: seedEnvelope({ tenant: "school-jlm" }),
|
|
78
|
-
});
|
|
79
|
-
const tlv = await app.runtime.getActorStore().load("ping", "p-2", "school-tlv");
|
|
80
|
-
const jlm = await app.runtime.getActorStore().load("ping", "p-2", "school-jlm");
|
|
81
|
-
const def = await app.runtime.getActorStore().load("ping", "p-2");
|
|
82
|
-
expect((tlv?.data).pings).toBe(1);
|
|
83
|
-
expect((jlm?.data).pings).toBe(1);
|
|
84
|
-
expect(def).toBeNull();
|
|
85
|
-
await worker.stop();
|
|
86
|
-
});
|
|
87
|
-
it("delayed messages fire after their delayMs (durable timer transport pattern)", async () => {
|
|
88
|
-
const app = createApp({ modules: [demoModule] });
|
|
89
|
-
const transport = new InMemoryQueueTransport();
|
|
90
|
-
const worker = createQueueWorker(app, transport, {
|
|
91
|
-
subscribe: [{ queue: "demo.ping", action: ping }],
|
|
92
|
-
});
|
|
93
|
-
await worker.start();
|
|
94
|
-
// 50ms delay — quick for tests.
|
|
95
|
-
await transport.enqueue("demo.ping", {
|
|
96
|
-
input: { pingId: "p-delayed" },
|
|
97
|
-
envelope: seedEnvelope({}),
|
|
98
|
-
delayMs: 50,
|
|
99
|
-
});
|
|
100
|
-
// Not yet — message is in the future.
|
|
101
|
-
const before = await app.runtime.getActorStore().load("ping", "p-delayed");
|
|
102
|
-
expect(before).toBeNull();
|
|
103
|
-
// Wait past the delay.
|
|
104
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
105
|
-
await transport.flush();
|
|
106
|
-
const after = await app.runtime.getActorStore().load("ping", "p-delayed");
|
|
107
|
-
expect(after).not.toBeNull();
|
|
108
|
-
expect((after?.data).pings).toBe(1);
|
|
109
|
-
await worker.stop();
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
describe("subscription(...).from(source) — trigger source declaration (G6)", () => {
|
|
113
|
-
it("stashes the source and exposes it via worker.listSubscriptions()", async () => {
|
|
114
|
-
const sub = subscription({ queue: "demo.ping", action: ping }).from("internal-trigger");
|
|
115
|
-
expect(sub.source).toBe("internal-trigger");
|
|
116
|
-
expect(sub.queue).toBe("demo.ping");
|
|
117
|
-
// Idempotent — later .from() overrides earlier; original unchanged.
|
|
118
|
-
const twice = sub.from("scheduler");
|
|
119
|
-
expect(twice.source).toBe("scheduler");
|
|
120
|
-
expect(sub.source).toBe("internal-trigger");
|
|
121
|
-
const app = createApp({ modules: [demoModule] });
|
|
122
|
-
const transport = new InMemoryQueueTransport();
|
|
123
|
-
const worker = createQueueWorker(app, transport, {
|
|
124
|
-
subscribe: [
|
|
125
|
-
subscription({ queue: "demo.ping", action: ping }).from("stripe-webhook"),
|
|
126
|
-
{ queue: "demo.ping", action: ping }, // plain literal — no source
|
|
127
|
-
],
|
|
128
|
-
});
|
|
129
|
-
const list = worker.listSubscriptions();
|
|
130
|
-
expect(list).toEqual([
|
|
131
|
-
{ queue: "demo.ping", action: "demo.ping", source: "stripe-webhook" },
|
|
132
|
-
{ queue: "demo.ping", action: "demo.ping", source: undefined },
|
|
133
|
-
]);
|
|
134
|
-
await worker.stop();
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
//# sourceMappingURL=queue.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.test.js","sourceRoot":"","sources":["../../src/__tests__/queue.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEnF,MAAM,EAAE,YAAY,EAAE,WAAW,EAA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AAS,EAAE,cAAc,EACzB,OAAO,EAAE,wBAAwB,GAChC,cAAc,CA8BhB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue-interface.js","sourceRoot":"","sources":["../src/queue-interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EACL,iBAAiB,GAGlB,MAAM,mBAAmB,CAAC;AAS3B,MAAM,UAAU,cAAc,CAC5B,GAAQ,EACR,SAAyB,EACzB,OAAiC;IAEjC,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC1D,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,MAAM,KAAK,GAAmB;QAC5B,cAAc,EAAE,IAAI;QACpB,SAAS,EAAE,OAAO;QAClB,MAAM,EAAE,EAA4B;QACpC,MAAM;QACN,MAAM,CAAC,KAAqB;YAC1B,2DAA2D;QAC7D,CAAC;QACD,KAAK,CAAC,KAAK;YACT,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;gBACrB,OAAO,GAAG,IAAI,CAAC;YACjB,CAAC;QACH,CAAC;QACD,KAAK,CAAC,IAAI;YACR,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;gBACpB,OAAO,GAAG,KAAK,CAAC;YAClB,CAAC;QACH,CAAC;QACD,KAAK,CAAC,QAAQ;YACZ,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;KACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue-transport.d.ts","sourceRoot":"","sources":["../src/queue-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,WAAW,YA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js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,sBAAsB,GAIvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,iBAAiB,EACjB,YAAY,GAKb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,cAAc,EAAuB,MAAM,mBAAmB,CAAC"}
|