@hexok/integration-events 0.1.0 → 0.2.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 +9 -4
- package/dist/publisher.d.ts +7 -2
- package/dist/publisher.d.ts.map +1 -1
- package/dist/publisher.js +26 -7
- package/dist/publisher.js.map +1 -1
- package/dist/subscriber.d.ts +9 -2
- package/dist/subscriber.d.ts.map +1 -1
- package/dist/subscriber.js +57 -18
- package/dist/subscriber.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -28,6 +28,8 @@ export class Billing extends Contract('billing', {
|
|
|
28
28
|
|
|
29
29
|
`Message(type, version, schema)` is a hexok `Event` with a static and instance `version`. `parse` and `EventHandler` work on it.
|
|
30
30
|
|
|
31
|
+
Contract schemas describe JSON, the form the queue carries. `Date`, `bigint`, `Map`, and `Set` do not survive it. Use strings and numbers, such as an ISO string for a time. A `z.date()` field fails at `publish`.
|
|
32
|
+
|
|
31
33
|
`Contract(name, topics)` maps each key to the message classes on that topic. The queue topic is `<name>.<key>`, here `billing.invoices`. Names match `/^[A-Za-z0-9_-]+$/`. `Contract` throws when a topic is empty, when a class is not a `Message`, when a class is in two topics, or when two classes share a type and version in one topic.
|
|
32
34
|
|
|
33
35
|
## Publish
|
|
@@ -39,7 +41,7 @@ const billing = new IntegrationPublisher(Billing, { queue });
|
|
|
39
41
|
await billing.publish(new InvoicePaid({ invoiceId: 'inv_1', amountCents: 500 }));
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
`publish` takes any message in the contract and finds its topic. It validates the payload and throws `CodedError` `VALIDATION` before anything is sent. It resolves the envelope `id`.
|
|
44
|
+
`publish` takes any message in the contract and finds its topic. It validates the JSON form of the payload and sends that JSON form, so a consumer parsing it with the same schema accepts it. Keys the schema would strip are sent, so leave out what consumers should not see. A payload the schema rejects, or one that is not JSON, such as a `bigint` or a cycle, throws `CodedError` `VALIDATION` before anything is sent. It resolves the envelope `id`.
|
|
43
45
|
|
|
44
46
|
Pass `{ id, time, subject }` to set those envelope attributes. `id` defaults to a random UUID. Pass a stable id, such as an outbox row id, so a retried publish carries the same id. `subject` is usually the aggregate id.
|
|
45
47
|
|
|
@@ -68,12 +70,12 @@ await billing.subscribe({ maxDeliveries: 10, handlers: [new SyncInvoice(deps)] }
|
|
|
68
70
|
|
|
69
71
|
`service` names the consuming application. Each handler subscribes to the topic of its message with its own consumer group, `<service>:<handler token>`. Two services never share a group, so each receives every event. A failing handler does not redeliver to the others.
|
|
70
72
|
|
|
71
|
-
`subscribe` checks every handler before it subscribes any. It throws when a handler's message is not in the contract, or when two handlers would share a group on one topic. It resolves `{ topic, group, type, version }` for each subscription. `maxDeliveries` and `startFrom` pass through to `Queue.subscribe`.
|
|
73
|
+
`subscribe` checks every handler and reserves every group before it subscribes any. It throws when a handler's message is not in the contract, or when two handlers would share a group on one topic, even across concurrent calls. When a queue subscribe fails, the handlers that call subscribed are unsubscribed and the error is rethrown. A failed `subscribe` leaves nothing subscribed and can be retried. A group whose unsubscribe also fails stays reserved, and subscribing it again on that instance throws. It resolves `{ topic, group, type, version }` for each subscription. `maxDeliveries` and `startFrom` pass through to `Queue.subscribe`.
|
|
72
74
|
|
|
73
75
|
For each delivery:
|
|
74
76
|
|
|
75
77
|
- An event of another type or version is acked and skipped.
|
|
76
|
-
- A payload that is not an envelope, or data the message schema rejects, is logged, parked, and dropped. Pass a structural `logger` and `quarantine`. `@hexok/logger` and `@hexok/quarantine` fit them. A parked record has `source: 'integration-events'`, `operation: 'deliver'`, `subject` `topic:id`,
|
|
78
|
+
- A payload that is not an envelope, or data the message schema rejects, is logged, parked, and dropped. Pass a structural `logger` and `quarantine`. `@hexok/logger` and `@hexok/quarantine` fit them. A parked record has `source: 'integration-events'`, `operation: 'deliver'`, `subject` `topic:id`, `context.group`, and `attempts`, the delivery count. A schema rejection has `error.code` `VALIDATION`. When the park fails, the delivery throws, and the queue retries it up to `maxDeliveries`. Without a `quarantine`, the entry is logged and dropped. Each handler has its own group, so a malformed entry is parked once for each handler on its topic.
|
|
77
79
|
- `handle` receives the event and an `IntegrationMeta` of `{ id, source, time, subject }`. A throw follows the queue's retry rules.
|
|
78
80
|
|
|
79
81
|
Delivery is at least once. Make handlers idempotent with `meta.id`.
|
|
@@ -100,7 +102,7 @@ export class Billing extends Contract('billing', {
|
|
|
100
102
|
}) {}
|
|
101
103
|
```
|
|
102
104
|
|
|
103
|
-
`map` is typed from both schemas. One `publish` of v2 sends v2, then v1. Every copy has the same `id`, `time`, and `subject`. Each payload is validated before it is downgraded, and
|
|
105
|
+
`map` is typed from both schemas. One `publish` of v2 sends v2, then v1. Every copy has the same `id`, `time`, and `subject`. Each payload is validated before it is downgraded, and `map` receives the schema's output. A failure throws before anything is sent. A queue failure rejects `publish`, and copies already sent stay sent.
|
|
104
106
|
|
|
105
107
|
`publish` accepts only the newest version. An older version is a type error, and it throws at runtime. `ContractEvent` leaves it out.
|
|
106
108
|
|
|
@@ -108,6 +110,8 @@ The versions of one type in a topic form a chain. Each version downgrades to the
|
|
|
108
110
|
|
|
109
111
|
To retire v1, move every consumer to v2. Then remove v1 from the topic and the downgrade from v2. Publish that as a major version of the contract.
|
|
110
112
|
|
|
113
|
+
Retire a version only after its consumers move. A handler for a version the producer no longer sends receives nothing, and nothing is logged. A consumer that updates to the contract without that version throws at `subscribe`, because its handler's message is no longer in the contract.
|
|
114
|
+
|
|
111
115
|
## Envelope
|
|
112
116
|
|
|
113
117
|
The queue payload is a CloudEvents 1.0 event in structured JSON mode, with a `version` extension attribute. Applications in other languages read it as JSON.
|
|
@@ -133,4 +137,5 @@ The queue payload is a CloudEvents 1.0 event in structured JSON mode, with a `ve
|
|
|
133
137
|
- Backfill. A new consumer reaches only the entries the queue still holds. Load earlier state from the producer another way.
|
|
134
138
|
- Order. A queue can redeliver an entry after newer ones. Put an aggregate version or timestamp in the payload, and ignore a change older than the state you hold.
|
|
135
139
|
- The outbox. A crash between a database commit and `publish` loses the event. A transactional outbox prevents that. Pass the outbox row id as `id`.
|
|
140
|
+
- Read cost. Every handler reads every entry on its topic, each version copy and each type, and skips the ones that are not its own. Keep topics narrow, such as one per aggregate.
|
|
136
141
|
- Topic ownership. Grant the producer write access to its topics and consumers read access, in the broker.
|
package/dist/publisher.d.ts
CHANGED
|
@@ -27,10 +27,15 @@ export declare class IntegrationPublisher<C extends ContractDefinition> {
|
|
|
27
27
|
* earlier version in the topic, newest first. Every copy has the same `id`,
|
|
28
28
|
* `time`, and `subject`. Resolves the `id`.
|
|
29
29
|
*
|
|
30
|
+
* Each payload is validated in its JSON form, the form the queue carries,
|
|
31
|
+
* and that JSON form is what is sent, so a consumer parsing it with the
|
|
32
|
+
* same schema accepts it. A `Date` arrives as a string, so a `z.date()`
|
|
33
|
+
* field fails here and not at every consumer.
|
|
34
|
+
*
|
|
30
35
|
* Throws when the message is not in the contract, or when it has a newer
|
|
31
36
|
* version. Throws `CodedError` `VALIDATION` before publishing anything when
|
|
32
|
-
* a payload or a downgraded payload fails its schema. A
|
|
33
|
-
* rejects, and copies already published stay published.
|
|
37
|
+
* a payload or a downgraded payload is not JSON or fails its schema. A
|
|
38
|
+
* queue failure rejects, and copies already published stay published.
|
|
34
39
|
*/
|
|
35
40
|
publish(event: ContractEvent<C>, options?: PublishOptions): Promise<string>;
|
|
36
41
|
}
|
package/dist/publisher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publisher.d.ts","sourceRoot":"","sources":["../src/publisher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAIvE,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC7B,6GAA6G;IAC7G,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,uBAAuB;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,qBAAa,oBAAoB,CAAC,CAAC,SAAS,kBAAkB;;gBAMhD,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;KAAE;IAYxD
|
|
1
|
+
{"version":3,"file":"publisher.d.ts","sourceRoot":"","sources":["../src/publisher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAIvE,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC7B,6GAA6G;IAC7G,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,uBAAuB;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,qBAAa,oBAAoB,CAAC,CAAC,SAAS,kBAAkB;;gBAMhD,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;KAAE;IAYxD;;;;;;;;;;;;;;OAcG;IACG,OAAO,CACX,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC;CAiCnB"}
|
package/dist/publisher.js
CHANGED
|
@@ -30,10 +30,15 @@ export class IntegrationPublisher {
|
|
|
30
30
|
* earlier version in the topic, newest first. Every copy has the same `id`,
|
|
31
31
|
* `time`, and `subject`. Resolves the `id`.
|
|
32
32
|
*
|
|
33
|
+
* Each payload is validated in its JSON form, the form the queue carries,
|
|
34
|
+
* and that JSON form is what is sent, so a consumer parsing it with the
|
|
35
|
+
* same schema accepts it. A `Date` arrives as a string, so a `z.date()`
|
|
36
|
+
* field fails here and not at every consumer.
|
|
37
|
+
*
|
|
33
38
|
* Throws when the message is not in the contract, or when it has a newer
|
|
34
39
|
* version. Throws `CodedError` `VALIDATION` before publishing anything when
|
|
35
|
-
* a payload or a downgraded payload fails its schema. A
|
|
36
|
-
* rejects, and copies already published stay published.
|
|
40
|
+
* a payload or a downgraded payload is not JSON or fails its schema. A
|
|
41
|
+
* queue failure rejects, and copies already published stay published.
|
|
37
42
|
*/
|
|
38
43
|
async publish(event, options = {}) {
|
|
39
44
|
const instance = event;
|
|
@@ -64,25 +69,39 @@ export class IntegrationPublisher {
|
|
|
64
69
|
return id;
|
|
65
70
|
}
|
|
66
71
|
}
|
|
67
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* The payload at each version, newest first. Each version's JSON copy is
|
|
74
|
+
* validated and sent. The schema's output is the input to the next downgrade.
|
|
75
|
+
*/
|
|
68
76
|
function chain(newest, payload) {
|
|
69
77
|
const versions = [];
|
|
70
78
|
let message = newest;
|
|
71
79
|
let current = payload;
|
|
72
80
|
while (message !== undefined) {
|
|
73
|
-
const
|
|
81
|
+
const json = toJson(message, current);
|
|
82
|
+
const parsed = validate(message.schema, json);
|
|
74
83
|
if (!parsed.ok) {
|
|
75
|
-
throw validationError(`integration-events:
|
|
84
|
+
throw validationError(`integration-events: ${describe(message)} validation failed`, parsed.issues);
|
|
76
85
|
}
|
|
77
|
-
versions.push({ message, payload:
|
|
86
|
+
versions.push({ message, payload: json });
|
|
78
87
|
const downgrade = message.downgrade;
|
|
79
88
|
if (downgrade === undefined)
|
|
80
89
|
break;
|
|
81
|
-
current = downgrade.map(
|
|
90
|
+
current = downgrade.map(parsed.value);
|
|
82
91
|
message = downgrade.to;
|
|
83
92
|
}
|
|
84
93
|
return versions;
|
|
85
94
|
}
|
|
95
|
+
/** The payload after a JSON round trip. Throws `VALIDATION` when it has no JSON form, such as a `bigint` or a cycle. */
|
|
96
|
+
function toJson(message, payload) {
|
|
97
|
+
try {
|
|
98
|
+
return JSON.parse(JSON.stringify(payload));
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
const reason = error instanceof Error ? `: ${error.message}` : '';
|
|
102
|
+
throw validationError(`integration-events: ${describe(message)} payload is not JSON${reason}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
86
105
|
function describe(event) {
|
|
87
106
|
const { token, version } = event;
|
|
88
107
|
return `"${String(token)}" v${String(version)}`;
|
package/dist/publisher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publisher.js","sourceRoot":"","sources":["../src/publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAelD;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAoB;IACtB,OAAO,CAAS;IAChB,MAAM,CAAQ;IACd,QAAQ,GAAG,IAAI,GAAG,EAA8B,CAAC;IACjD,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAC;IAErD,YAAY,QAAW,EAAE,IAA+B;QACtD,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACnD,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACrC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;gBACvC,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;gBACjC,IAAI,EAAE,KAAK,SAAS;oBAAE,IAAI,CAAC,WAAW,CAAC,GA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C;AAED,SAAS,QAAQ,CAAC,KAAa;IAC7B,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,KAG1B,CAAC;IACF,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;AAClD,CAAC"}
|
package/dist/subscriber.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface ParkInput {
|
|
|
15
15
|
readonly message: string;
|
|
16
16
|
readonly code?: string;
|
|
17
17
|
};
|
|
18
|
+
readonly attempts?: number;
|
|
18
19
|
readonly occurredAt: Date;
|
|
19
20
|
readonly context?: Readonly<Record<string, string>>;
|
|
20
21
|
}
|
|
@@ -69,10 +70,16 @@ export declare class IntegrationSubscriber<C extends ContractDefinition> {
|
|
|
69
70
|
* before it subscribes any. Throws when a handler's message is not in the
|
|
70
71
|
* contract, or when two handlers would share a group on one topic.
|
|
71
72
|
*
|
|
73
|
+
* When a queue subscribe fails, the handlers this call already subscribed
|
|
74
|
+
* are unsubscribed and the error is rethrown. A failed subscribe leaves
|
|
75
|
+
* nothing subscribed and can be retried. A group whose unsubscribe also
|
|
76
|
+
* fails stays reserved, so subscribing it again on this instance throws.
|
|
77
|
+
*
|
|
72
78
|
* A delivery of another type or version is acked and skipped. A payload
|
|
73
79
|
* that is not an envelope, or data its schema rejects, is logged, parked
|
|
74
|
-
* when a quarantine sink is set, and dropped.
|
|
75
|
-
* the queue
|
|
80
|
+
* when a quarantine sink is set, and dropped. When the park fails, the
|
|
81
|
+
* delivery throws and the queue retries it. With no quarantine sink, it is
|
|
82
|
+
* logged and dropped. A throw from `handle` follows the queue's retry rules.
|
|
76
83
|
*/
|
|
77
84
|
subscribe(options: SubscribeOptions<C>): Promise<Subscription[]>;
|
|
78
85
|
}
|
package/dist/subscriber.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriber.d.ts","sourceRoot":"","sources":["../src/subscriber.ts"],"names":[],"mappings":"AAA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,CAAC,QAAQ,EAAE,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;CACrD;AAED,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAQD;;;;;;;;GAQG;AACH,qBAAa,qBAAqB,CAAC,CAAC,SAAS,kBAAkB;;gBAU3D,QAAQ,EAAE,CAAC,EACX,IAAI,EAAE;QACJ,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;QACtB,oEAAoE;QACpE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC;KAChC;IAsBH;;;;;;;;;;;;;;;OAeG;IACG,SAAS,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;CA2JvE"}
|
package/dist/subscriber.js
CHANGED
|
@@ -39,29 +39,49 @@ export class IntegrationSubscriber {
|
|
|
39
39
|
* before it subscribes any. Throws when a handler's message is not in the
|
|
40
40
|
* contract, or when two handlers would share a group on one topic.
|
|
41
41
|
*
|
|
42
|
+
* When a queue subscribe fails, the handlers this call already subscribed
|
|
43
|
+
* are unsubscribed and the error is rethrown. A failed subscribe leaves
|
|
44
|
+
* nothing subscribed and can be retried. A group whose unsubscribe also
|
|
45
|
+
* fails stays reserved, so subscribing it again on this instance throws.
|
|
46
|
+
*
|
|
42
47
|
* A delivery of another type or version is acked and skipped. A payload
|
|
43
48
|
* that is not an envelope, or data its schema rejects, is logged, parked
|
|
44
|
-
* when a quarantine sink is set, and dropped.
|
|
45
|
-
* the queue
|
|
49
|
+
* when a quarantine sink is set, and dropped. When the park fails, the
|
|
50
|
+
* delivery throws and the queue retries it. With no quarantine sink, it is
|
|
51
|
+
* logged and dropped. A throw from `handle` follows the queue's retry rules.
|
|
46
52
|
*/
|
|
47
53
|
async subscribe(options) {
|
|
48
54
|
const plans = this.#plan(options.handlers);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
// Reserve every group before any await, so a concurrent call sees them.
|
|
56
|
+
const keys = plans.map(({ subscription }) => groupKey(subscription.topic, subscription.group));
|
|
57
|
+
for (const key of keys)
|
|
58
|
+
this.#groups.add(key);
|
|
59
|
+
const subscribed = [];
|
|
60
|
+
try {
|
|
61
|
+
for (const plan of plans) {
|
|
62
|
+
const { topic, group } = plan.subscription;
|
|
63
|
+
await this.#queue.subscribe(topic, {
|
|
64
|
+
consumerGroup: group,
|
|
65
|
+
maxDeliveries: options.maxDeliveries,
|
|
66
|
+
...(options.startFrom !== undefined
|
|
67
|
+
? { startFrom: options.startFrom }
|
|
68
|
+
: {}),
|
|
69
|
+
handler: (message) => this.#deliver(plan, message),
|
|
70
|
+
});
|
|
71
|
+
subscribed.push(plan.subscription);
|
|
72
|
+
}
|
|
62
73
|
}
|
|
63
|
-
|
|
74
|
+
catch (error) {
|
|
75
|
+
const stuck = await this.#rollback(subscribed);
|
|
76
|
+
for (const key of keys) {
|
|
77
|
+
if (!stuck.has(key))
|
|
78
|
+
this.#groups.delete(key);
|
|
79
|
+
}
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
return subscribed;
|
|
64
83
|
}
|
|
84
|
+
/** Checks every handler against the contract and this instance's groups. */
|
|
65
85
|
#plan(handlers) {
|
|
66
86
|
const planned = new Map();
|
|
67
87
|
for (const handler of handlers) {
|
|
@@ -89,6 +109,22 @@ export class IntegrationSubscriber {
|
|
|
89
109
|
}
|
|
90
110
|
return [...planned.values()];
|
|
91
111
|
}
|
|
112
|
+
/** Unsubscribes each subscription. Resolves the group keys whose unsubscribe failed. */
|
|
113
|
+
async #rollback(subscriptions) {
|
|
114
|
+
const results = await Promise.allSettled(subscriptions.map(({ topic, group }) => this.#queue.unsubscribe(topic, { consumerGroup: group })));
|
|
115
|
+
const stuck = new Set();
|
|
116
|
+
results.forEach((result, index) => {
|
|
117
|
+
const subscription = subscriptions[index];
|
|
118
|
+
if (result.status === 'fulfilled' || subscription === undefined)
|
|
119
|
+
return;
|
|
120
|
+
const { topic, group } = subscription;
|
|
121
|
+
stuck.add(groupKey(topic, group));
|
|
122
|
+
this.#logger?.error(result.reason instanceof Error
|
|
123
|
+
? result.reason
|
|
124
|
+
: new Error('integration-events: unsubscribe failed'), { topic, group });
|
|
125
|
+
});
|
|
126
|
+
return stuck;
|
|
127
|
+
}
|
|
92
128
|
async #deliver(plan, delivery) {
|
|
93
129
|
const envelope = readEnvelope(delivery.payload);
|
|
94
130
|
if (envelope === undefined) {
|
|
@@ -128,14 +164,17 @@ export class IntegrationSubscriber {
|
|
|
128
164
|
error: error instanceof CodedError
|
|
129
165
|
? { name: error.name, message: error.message, code: error.code }
|
|
130
166
|
: { name: error.name, message: error.message },
|
|
167
|
+
attempts: delivery.deliveries,
|
|
131
168
|
occurredAt: new Date(),
|
|
132
169
|
context: { group },
|
|
133
170
|
});
|
|
134
171
|
}
|
|
135
172
|
catch (parkError) {
|
|
136
|
-
|
|
173
|
+
const failure = parkError instanceof Error
|
|
137
174
|
? parkError
|
|
138
|
-
: new Error('integration-events: park failed')
|
|
175
|
+
: new Error('integration-events: park failed');
|
|
176
|
+
this.#logger?.error(failure, { topic, group, id: delivery.id });
|
|
177
|
+
throw failure;
|
|
139
178
|
}
|
|
140
179
|
}
|
|
141
180
|
}
|
package/dist/subscriber.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriber.js","sourceRoot":"","sources":["../src/subscriber.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,cAAc,GAAG,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"subscriber.js","sourceRoot":"","sources":["../src/subscriber.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,cAAc,GAAG,kBAAkB,CAAC;AA2D1C;;;;;;;;GAQG;AACH,MAAM,OAAO,qBAAqB;IACvB,SAAS,CAAI;IACb,MAAM,CAAQ;IACd,QAAQ,CAAS;IACjB,OAAO,CAAsB;IAC7B,WAAW,CAAuB;IAClC,QAAQ,GAAG,IAAI,GAAG,EAA8B,CAAC;IACjD,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAErC,YACE,QAAW,EACX,IAMC;QAED,IACE,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ;YAChC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAClC,CAAC;YACD,MAAM,IAAI,KAAK,CACb,gCAAgC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,cAAc,EAAE,CACrF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,QA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C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hexok/integration-events",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Versioned events that cross product and service boundaries, over the hexok queue port.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@hexok/queue": "^1.0.0",
|
|
46
|
-
"hexok": "^2.2.
|
|
46
|
+
"hexok": "^2.2.5"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@hexok/queue-redis": "^1.1.3",
|