@zdavison/matador 2.0.1
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/cli.ts +453 -0
- package/dist/checkpoint/context.d.ts +59 -0
- package/dist/checkpoint/context.d.ts.map +1 -0
- package/dist/checkpoint/context.js +140 -0
- package/dist/checkpoint/context.test.d.ts +2 -0
- package/dist/checkpoint/context.test.d.ts.map +1 -0
- package/dist/checkpoint/context.test.js +424 -0
- package/dist/checkpoint/index.d.ts +7 -0
- package/dist/checkpoint/index.d.ts.map +1 -0
- package/dist/checkpoint/index.js +6 -0
- package/dist/checkpoint/stores/memory.d.ts +29 -0
- package/dist/checkpoint/stores/memory.d.ts.map +1 -0
- package/dist/checkpoint/stores/memory.js +39 -0
- package/dist/checkpoint/stores/noop.d.ts +14 -0
- package/dist/checkpoint/stores/noop.d.ts.map +1 -0
- package/dist/checkpoint/stores/noop.js +18 -0
- package/dist/checkpoint/stores/stores.test.d.ts +2 -0
- package/dist/checkpoint/stores/stores.test.d.ts.map +1 -0
- package/dist/checkpoint/stores/stores.test.js +146 -0
- package/dist/checkpoint/types.d.ts +119 -0
- package/dist/checkpoint/types.d.ts.map +1 -0
- package/dist/checkpoint/types.js +1 -0
- package/dist/codec/codec.d.ts +29 -0
- package/dist/codec/codec.d.ts.map +1 -0
- package/dist/codec/codec.js +15 -0
- package/dist/codec/header-aware-codec.d.ts +36 -0
- package/dist/codec/header-aware-codec.d.ts.map +1 -0
- package/dist/codec/header-aware-codec.js +1 -0
- package/dist/codec/index.d.ts +6 -0
- package/dist/codec/index.d.ts.map +1 -0
- package/dist/codec/index.js +3 -0
- package/dist/codec/json-codec.d.ts +13 -0
- package/dist/codec/json-codec.d.ts.map +1 -0
- package/dist/codec/json-codec.js +64 -0
- package/dist/codec/rabbitmq-codec.d.ts +28 -0
- package/dist/codec/rabbitmq-codec.d.ts.map +1 -0
- package/dist/codec/rabbitmq-codec.js +242 -0
- package/dist/codec/rabbitmq-codec.test.d.ts +2 -0
- package/dist/codec/rabbitmq-codec.test.d.ts.map +1 -0
- package/dist/codec/rabbitmq-codec.test.js +433 -0
- package/dist/core/fanout.d.ts +59 -0
- package/dist/core/fanout.d.ts.map +1 -0
- package/dist/core/fanout.js +121 -0
- package/dist/core/fanout.test.d.ts +2 -0
- package/dist/core/fanout.test.d.ts.map +1 -0
- package/dist/core/fanout.test.js +1055 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +3 -0
- package/dist/core/matador.d.ts +133 -0
- package/dist/core/matador.d.ts.map +1 -0
- package/dist/core/matador.js +222 -0
- package/dist/core/matador.test.d.ts +2 -0
- package/dist/core/matador.test.d.ts.map +1 -0
- package/dist/core/matador.test.js +446 -0
- package/dist/core/shutdown.d.ts +78 -0
- package/dist/core/shutdown.d.ts.map +1 -0
- package/dist/core/shutdown.js +111 -0
- package/dist/core/shutdown.test.d.ts +2 -0
- package/dist/core/shutdown.test.d.ts.map +1 -0
- package/dist/core/shutdown.test.js +524 -0
- package/dist/errors/checkpoint-errors.d.ts +30 -0
- package/dist/errors/checkpoint-errors.d.ts.map +1 -0
- package/dist/errors/checkpoint-errors.js +49 -0
- package/dist/errors/has-description.d.ts +18 -0
- package/dist/errors/has-description.d.ts.map +1 -0
- package/dist/errors/has-description.js +9 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +22 -0
- package/dist/errors/matador-errors.d.ts +183 -0
- package/dist/errors/matador-errors.d.ts.map +1 -0
- package/dist/errors/matador-errors.js +376 -0
- package/dist/errors/retry-errors.d.ts +67 -0
- package/dist/errors/retry-errors.d.ts.map +1 -0
- package/dist/errors/retry-errors.js +108 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/safe-hooks.d.ts +34 -0
- package/dist/hooks/safe-hooks.d.ts.map +1 -0
- package/dist/hooks/safe-hooks.js +135 -0
- package/dist/hooks/types.d.ts +189 -0
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/hooks/types.js +9 -0
- package/dist/index.cjs +3156 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/pipeline/index.d.ts +3 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +1 -0
- package/dist/pipeline/pipeline.d.ts +60 -0
- package/dist/pipeline/pipeline.d.ts.map +1 -0
- package/dist/pipeline/pipeline.js +261 -0
- package/dist/pipeline/pipeline.test.d.ts +2 -0
- package/dist/pipeline/pipeline.test.d.ts.map +1 -0
- package/dist/pipeline/pipeline.test.js +1065 -0
- package/dist/retry/index.d.ts +4 -0
- package/dist/retry/index.d.ts.map +1 -0
- package/dist/retry/index.js +1 -0
- package/dist/retry/policy.d.ts +43 -0
- package/dist/retry/policy.d.ts.map +1 -0
- package/dist/retry/policy.js +1 -0
- package/dist/retry/standard-policy.d.ts +44 -0
- package/dist/retry/standard-policy.d.ts.map +1 -0
- package/dist/retry/standard-policy.js +102 -0
- package/dist/retry/standard-policy.test.d.ts +2 -0
- package/dist/retry/standard-policy.test.d.ts.map +1 -0
- package/dist/retry/standard-policy.test.js +190 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +2 -0
- package/dist/schema/registry.d.ts +63 -0
- package/dist/schema/registry.d.ts.map +1 -0
- package/dist/schema/registry.js +171 -0
- package/dist/schema/registry.test.d.ts +2 -0
- package/dist/schema/registry.test.d.ts.map +1 -0
- package/dist/schema/registry.test.js +278 -0
- package/dist/schema/types.d.ts +158 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +74 -0
- package/dist/schema/types.test.d.ts +2 -0
- package/dist/schema/types.test.d.ts.map +1 -0
- package/dist/schema/types.test.js +243 -0
- package/dist/topology/builder.d.ts +66 -0
- package/dist/topology/builder.d.ts.map +1 -0
- package/dist/topology/builder.js +156 -0
- package/dist/topology/builder.test.d.ts +2 -0
- package/dist/topology/builder.test.d.ts.map +1 -0
- package/dist/topology/builder.test.js +222 -0
- package/dist/topology/index.d.ts +5 -0
- package/dist/topology/index.d.ts.map +1 -0
- package/dist/topology/index.js +2 -0
- package/dist/topology/types.d.ts +76 -0
- package/dist/topology/types.d.ts.map +1 -0
- package/dist/topology/types.js +18 -0
- package/dist/transport/capabilities.d.ts +66 -0
- package/dist/transport/capabilities.d.ts.map +1 -0
- package/dist/transport/capabilities.js +18 -0
- package/dist/transport/connection-manager.d.ts +95 -0
- package/dist/transport/connection-manager.d.ts.map +1 -0
- package/dist/transport/connection-manager.js +144 -0
- package/dist/transport/index.d.ts +11 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +5 -0
- package/dist/transport/local/local-transport.d.ts +62 -0
- package/dist/transport/local/local-transport.d.ts.map +1 -0
- package/dist/transport/local/local-transport.js +241 -0
- package/dist/transport/local/local-transport.test.d.ts +2 -0
- package/dist/transport/local/local-transport.test.d.ts.map +1 -0
- package/dist/transport/local/local-transport.test.js +192 -0
- package/dist/transport/multi/multi-transport.d.ts +94 -0
- package/dist/transport/multi/multi-transport.d.ts.map +1 -0
- package/dist/transport/multi/multi-transport.js +184 -0
- package/dist/transport/multi/multi-transport.test.d.ts +2 -0
- package/dist/transport/multi/multi-transport.test.d.ts.map +1 -0
- package/dist/transport/multi/multi-transport.test.js +236 -0
- package/dist/transport/rabbitmq/rabbitmq-transport.d.ts +73 -0
- package/dist/transport/rabbitmq/rabbitmq-transport.d.ts.map +1 -0
- package/dist/transport/rabbitmq/rabbitmq-transport.js +518 -0
- package/dist/transport/transport.d.ts +152 -0
- package/dist/transport/transport.d.ts.map +1 -0
- package/dist/transport/transport.js +1 -0
- package/dist/types/common.d.ts +41 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +12 -0
- package/dist/types/envelope.d.ts +82 -0
- package/dist/types/envelope.d.ts.map +1 -0
- package/dist/types/envelope.js +36 -0
- package/dist/types/event.d.ts +96 -0
- package/dist/types/event.d.ts.map +1 -0
- package/dist/types/event.js +26 -0
- package/dist/types/event.test.d.ts +2 -0
- package/dist/types/event.test.d.ts.map +1 -0
- package/dist/types/event.test.js +130 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/subscriber.d.ts +207 -0
- package/dist/types/subscriber.d.ts.map +1 -0
- package/dist/types/subscriber.js +99 -0
- package/examples/config.ts +126 -0
- package/examples/event.ts +26 -0
- package/examples/order-event.json +19 -0
- package/package.json +66 -0
- package/src/checkpoint/context.test.ts +510 -0
- package/src/checkpoint/context.ts +213 -0
- package/src/checkpoint/index.ts +30 -0
- package/src/checkpoint/stores/memory.ts +47 -0
- package/src/checkpoint/stores/noop.ts +22 -0
- package/src/checkpoint/stores/stores.test.ts +177 -0
- package/src/checkpoint/types.ts +147 -0
- package/src/codec/codec.ts +42 -0
- package/src/codec/header-aware-codec.ts +41 -0
- package/src/codec/index.ts +11 -0
- package/src/codec/json-codec.ts +69 -0
- package/src/codec/rabbitmq-codec.test.ts +516 -0
- package/src/codec/rabbitmq-codec.ts +336 -0
- package/src/core/fanout.test.ts +1351 -0
- package/src/core/fanout.ts +184 -0
- package/src/core/index.ts +12 -0
- package/src/core/matador.test.ts +575 -0
- package/src/core/matador.ts +344 -0
- package/src/core/shutdown.test.ts +853 -0
- package/src/core/shutdown.ts +165 -0
- package/src/errors/checkpoint-errors.ts +62 -0
- package/src/errors/has-description.ts +25 -0
- package/src/errors/index.ts +57 -0
- package/src/errors/matador-errors.ts +477 -0
- package/src/errors/retry-errors.ts +134 -0
- package/src/hooks/index.ts +15 -0
- package/src/hooks/safe-hooks.ts +223 -0
- package/src/hooks/types.ts +248 -0
- package/src/index.ts +231 -0
- package/src/pipeline/index.ts +2 -0
- package/src/pipeline/pipeline.test.ts +1317 -0
- package/src/pipeline/pipeline.ts +371 -0
- package/src/retry/index.ts +4 -0
- package/src/retry/policy.ts +46 -0
- package/src/retry/standard-policy.test.ts +282 -0
- package/src/retry/standard-policy.ts +156 -0
- package/src/schema/index.ts +16 -0
- package/src/schema/registry.test.ts +339 -0
- package/src/schema/registry.ts +226 -0
- package/src/schema/types.test.ts +281 -0
- package/src/schema/types.ts +217 -0
- package/src/topology/builder.test.ts +275 -0
- package/src/topology/builder.ts +199 -0
- package/src/topology/index.ts +15 -0
- package/src/topology/types.ts +109 -0
- package/src/transport/capabilities.ts +88 -0
- package/src/transport/connection-manager.ts +218 -0
- package/src/transport/index.ts +42 -0
- package/src/transport/local/local-transport.test.ts +262 -0
- package/src/transport/local/local-transport.ts +327 -0
- package/src/transport/multi/multi-transport.test.ts +320 -0
- package/src/transport/multi/multi-transport.ts +294 -0
- package/src/transport/rabbitmq/rabbitmq-transport.ts +753 -0
- package/src/transport/transport.ts +200 -0
- package/src/types/common.ts +53 -0
- package/src/types/envelope.ts +152 -0
- package/src/types/event.test.ts +157 -0
- package/src/types/event.ts +118 -0
- package/src/types/index.ts +52 -0
- package/src/types/subscriber.ts +310 -0
- package/test/e2e/multi-transport.e2e.test.ts +236 -0
- package/test/e2e/rabbitmq-transport.e2e.test.ts +327 -0
- package/test/e2e/transport-compliance.e2e.test.ts +505 -0
- package/test/integration/matador.integration.test.ts +634 -0
- package/tsconfig.json +29 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsup.config.ts +13 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for retry control errors.
|
|
3
|
+
* These errors control the retry behavior of message processing.
|
|
4
|
+
*/
|
|
5
|
+
export class RetryControlError extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = this.constructor.name;
|
|
9
|
+
// Ensure name is preserved when serialized
|
|
10
|
+
Object.defineProperty(this, 'name', {
|
|
11
|
+
value: this.constructor.name,
|
|
12
|
+
enumerable: true,
|
|
13
|
+
configurable: false,
|
|
14
|
+
writable: false,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns a serializable representation for logging/monitoring.
|
|
19
|
+
*/
|
|
20
|
+
toJSON() {
|
|
21
|
+
return {
|
|
22
|
+
name: this.name,
|
|
23
|
+
message: this.message,
|
|
24
|
+
description: this.description,
|
|
25
|
+
stack: this.stack,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Forces retry regardless of subscriber idempotency setting.
|
|
31
|
+
* Use when you know the operation is safe to retry.
|
|
32
|
+
*
|
|
33
|
+
* ACTION: Check subscriber code to understand why retry was forced.
|
|
34
|
+
* This overrides default retry behavior based on idempotency settings.
|
|
35
|
+
*/
|
|
36
|
+
export class DoRetry extends RetryControlError {
|
|
37
|
+
description = 'A subscriber explicitly requested retry by throwing DoRetry. ' +
|
|
38
|
+
'ACTION: Check the subscriber code to understand why retry was forced. ' +
|
|
39
|
+
'This overrides the default retry behavior based on idempotency settings.';
|
|
40
|
+
constructor(message = 'Forced retry requested') {
|
|
41
|
+
super(message);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Prevents retry regardless of subscriber idempotency setting.
|
|
46
|
+
* Use for permanent failures that should not be retried.
|
|
47
|
+
*
|
|
48
|
+
* ACTION: Check subscriber code to understand why retry was disabled.
|
|
49
|
+
* Typically used for permanent failures like invalid data or business rule violations.
|
|
50
|
+
*/
|
|
51
|
+
export class DontRetry extends RetryControlError {
|
|
52
|
+
description = 'A subscriber explicitly prevented retry by throwing DontRetry. ' +
|
|
53
|
+
'ACTION: Check the subscriber code to understand why retry was disabled. ' +
|
|
54
|
+
'Typically used for permanent failures like invalid data or business rule violations. ' +
|
|
55
|
+
'The message will be sent to the dead-letter queue for manual review.';
|
|
56
|
+
constructor(message = 'Retry explicitly disabled') {
|
|
57
|
+
super(message);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Assertion error that should never be retried.
|
|
62
|
+
* Use for programming errors and invariant violations.
|
|
63
|
+
*
|
|
64
|
+
* ACTION: Review the assertion failure message to identify the bug
|
|
65
|
+
* in the event payload or subscriber logic.
|
|
66
|
+
*/
|
|
67
|
+
export class EventAssertionError extends Error {
|
|
68
|
+
description = 'An event assertion failed, indicating a programming error or invariant violation. ' +
|
|
69
|
+
'ACTION: Review the assertion failure message to identify the bug in the ' +
|
|
70
|
+
'event payload or subscriber logic. These errors are never retried and go ' +
|
|
71
|
+
'directly to the dead-letter queue.';
|
|
72
|
+
constructor(message) {
|
|
73
|
+
super(message);
|
|
74
|
+
this.name = 'EventAssertionError';
|
|
75
|
+
Object.defineProperty(this, 'name', {
|
|
76
|
+
value: 'EventAssertionError',
|
|
77
|
+
enumerable: true,
|
|
78
|
+
configurable: false,
|
|
79
|
+
writable: false,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
toJSON() {
|
|
83
|
+
return {
|
|
84
|
+
name: this.name,
|
|
85
|
+
message: this.message,
|
|
86
|
+
description: this.description,
|
|
87
|
+
stack: this.stack,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Checks if an error forces a retry.
|
|
93
|
+
*/
|
|
94
|
+
export function isDoRetry(error) {
|
|
95
|
+
return error instanceof DoRetry;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Checks if an error prevents retry.
|
|
99
|
+
*/
|
|
100
|
+
export function isDontRetry(error) {
|
|
101
|
+
return error instanceof DontRetry;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Checks if an error is an assertion error (never retry).
|
|
105
|
+
*/
|
|
106
|
+
export function isAssertionError(error) {
|
|
107
|
+
return error instanceof EventAssertionError;
|
|
108
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { DecodeErrorContext, EnqueueErrorContext, EnqueueSuccessContext, EnqueueWarningContext, Logger, MatadorHooks, TransportFallbackContext, WorkerErrorContext, WorkerExecuteFn, WorkerSuccessContext, } from './types.js';
|
|
2
|
+
export { consoleLogger } from './types.js';
|
|
3
|
+
export { SafeHooks } from './safe-hooks.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,EACN,YAAY,EACZ,wBAAwB,EACxB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CheckpointClearedContext, CheckpointHitContext, CheckpointLoadedContext, CheckpointMissContext } from '../checkpoint/index.js';
|
|
2
|
+
import type { ConnectionState } from '../transport/index.js';
|
|
3
|
+
import type { Envelope, SubscriberDefinition } from '../types/index.js';
|
|
4
|
+
import { type DecodeErrorContext, type EnqueueErrorContext, type EnqueueSuccessContext, type EnqueueWarningContext, type Logger, type MatadorHooks, type WorkerErrorContext, type WorkerExecuteFn, type WorkerSuccessContext } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Wraps hooks with error handling to prevent hook errors from breaking processing.
|
|
7
|
+
* All hooks become safe to call and will catch any errors internally.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SafeHooks {
|
|
10
|
+
private readonly hooks;
|
|
11
|
+
/** The logger instance used by Matador. */
|
|
12
|
+
readonly logger: Logger;
|
|
13
|
+
constructor(hooks?: MatadorHooks);
|
|
14
|
+
onEnqueueSuccess(context: EnqueueSuccessContext): Promise<void>;
|
|
15
|
+
onEnqueueWarning(context: EnqueueWarningContext): Promise<void>;
|
|
16
|
+
onEnqueueError(context: EnqueueErrorContext): Promise<void>;
|
|
17
|
+
onWorkerWrap(envelope: Envelope, subscriber: SubscriberDefinition, execute: WorkerExecuteFn): Promise<void>;
|
|
18
|
+
onWorkerBeforeProcess(envelope: Envelope, subscriber: SubscriberDefinition): Promise<void>;
|
|
19
|
+
onWorkerSuccess(context: WorkerSuccessContext): Promise<void>;
|
|
20
|
+
onWorkerError(context: WorkerErrorContext): Promise<void>;
|
|
21
|
+
onDecodeError(context: DecodeErrorContext): Promise<void>;
|
|
22
|
+
onConnectionStateChange(state: ConnectionState): Promise<void>;
|
|
23
|
+
loadUniversalMetadata(): Promise<Record<string, unknown>>;
|
|
24
|
+
getQueueConcurrency(queueName: string): Promise<number | undefined>;
|
|
25
|
+
getRetryDelay(envelope: Envelope, attemptNumber: number): Promise<number | undefined>;
|
|
26
|
+
getAttempts(envelope: Envelope): Promise<number | undefined>;
|
|
27
|
+
getMaxDeliveries(envelope: Envelope): Promise<number | undefined>;
|
|
28
|
+
onCheckpointLoaded(context: CheckpointLoadedContext): Promise<void>;
|
|
29
|
+
onCheckpointHit(context: CheckpointHitContext): Promise<void>;
|
|
30
|
+
onCheckpointMiss(context: CheckpointMissContext): Promise<void>;
|
|
31
|
+
onCheckpointCleared(context: CheckpointClearedContext): Promise<void>;
|
|
32
|
+
private safeCall;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=safe-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-hooks.d.ts","sourceRoot":"","sources":["../../src/hooks/safe-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAA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OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAiBzD,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAgBnE,aAAa,CACjB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAaxB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAa5D,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAkBjE,kBAAkB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMnE,eAAe,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7D,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAM/D,mBAAmB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;YAM7D,QAAQ;CAUvB"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { consoleLogger, } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Wraps hooks with error handling to prevent hook errors from breaking processing.
|
|
4
|
+
* All hooks become safe to call and will catch any errors internally.
|
|
5
|
+
*/
|
|
6
|
+
export class SafeHooks {
|
|
7
|
+
hooks;
|
|
8
|
+
/** The logger instance used by Matador. */
|
|
9
|
+
logger;
|
|
10
|
+
constructor(hooks = {}) {
|
|
11
|
+
this.hooks = hooks;
|
|
12
|
+
this.logger = hooks.logger ?? consoleLogger;
|
|
13
|
+
}
|
|
14
|
+
async onEnqueueSuccess(context) {
|
|
15
|
+
await this.safeCall('onEnqueueSuccess', () => this.hooks.onEnqueueSuccess?.(context));
|
|
16
|
+
}
|
|
17
|
+
async onEnqueueWarning(context) {
|
|
18
|
+
await this.safeCall('onEnqueueWarning', () => this.hooks.onEnqueueWarning?.(context));
|
|
19
|
+
}
|
|
20
|
+
async onEnqueueError(context) {
|
|
21
|
+
await this.safeCall('onEnqueueError', () => this.hooks.onEnqueueError?.(context));
|
|
22
|
+
}
|
|
23
|
+
async onWorkerWrap(envelope, subscriber, execute) {
|
|
24
|
+
if (this.hooks.onWorkerWrap) {
|
|
25
|
+
try {
|
|
26
|
+
await this.hooks.onWorkerWrap(envelope, subscriber, execute);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
this.logger.warn('[Matador] 🟡 Hook onWorkerWrap threw an error', error);
|
|
30
|
+
// Still try to execute if wrap failed
|
|
31
|
+
await execute();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
await execute();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async onWorkerBeforeProcess(envelope, subscriber) {
|
|
39
|
+
await this.safeCall('onWorkerBeforeProcess', () => this.hooks.onWorkerBeforeProcess?.(envelope, subscriber));
|
|
40
|
+
}
|
|
41
|
+
async onWorkerSuccess(context) {
|
|
42
|
+
await this.safeCall('onWorkerSuccess', () => this.hooks.onWorkerSuccess?.(context));
|
|
43
|
+
}
|
|
44
|
+
async onWorkerError(context) {
|
|
45
|
+
await this.safeCall('onWorkerError', () => this.hooks.onWorkerError?.(context));
|
|
46
|
+
}
|
|
47
|
+
async onDecodeError(context) {
|
|
48
|
+
await this.safeCall('onDecodeError', () => this.hooks.onDecodeError?.(context));
|
|
49
|
+
}
|
|
50
|
+
async onConnectionStateChange(state) {
|
|
51
|
+
await this.safeCall('onConnectionStateChange', () => this.hooks.onConnectionStateChange?.(state));
|
|
52
|
+
}
|
|
53
|
+
async loadUniversalMetadata() {
|
|
54
|
+
if (!this.hooks.loadUniversalMetadata) {
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
const result = await this.hooks.loadUniversalMetadata();
|
|
59
|
+
return result ?? {};
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
this.logger.warn('[Matador] 🟡 Hook loadUniversalMetadata threw an error', error);
|
|
63
|
+
return {};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async getQueueConcurrency(queueName) {
|
|
67
|
+
if (!this.hooks.getQueueConcurrency) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
return await this.hooks.getQueueConcurrency(queueName);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
this.logger.warn('[Matador] 🟡 Hook getQueueConcurrency threw an error', error);
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async getRetryDelay(envelope, attemptNumber) {
|
|
79
|
+
if (!this.hooks.getRetryDelay) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
return await this.hooks.getRetryDelay(envelope, attemptNumber);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
this.logger.warn('[Matador] 🟡 Hook getRetryDelay threw an error', error);
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async getAttempts(envelope) {
|
|
91
|
+
if (!this.hooks.getAttempts) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
return await this.hooks.getAttempts(envelope);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
this.logger.warn('[Matador] 🟡 Hook getAttempts threw an error', error);
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async getMaxDeliveries(envelope) {
|
|
103
|
+
if (!this.hooks.getMaxDeliveries) {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
return await this.hooks.getMaxDeliveries(envelope);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
this.logger.warn('[Matador] 🟡 Hook getMaxDeliveries threw an error', error);
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// === Checkpoint Hooks ===
|
|
115
|
+
async onCheckpointLoaded(context) {
|
|
116
|
+
await this.safeCall('onCheckpointLoaded', () => this.hooks.onCheckpointLoaded?.(context));
|
|
117
|
+
}
|
|
118
|
+
async onCheckpointHit(context) {
|
|
119
|
+
await this.safeCall('onCheckpointHit', () => this.hooks.onCheckpointHit?.(context));
|
|
120
|
+
}
|
|
121
|
+
async onCheckpointMiss(context) {
|
|
122
|
+
await this.safeCall('onCheckpointMiss', () => this.hooks.onCheckpointMiss?.(context));
|
|
123
|
+
}
|
|
124
|
+
async onCheckpointCleared(context) {
|
|
125
|
+
await this.safeCall('onCheckpointCleared', () => this.hooks.onCheckpointCleared?.(context));
|
|
126
|
+
}
|
|
127
|
+
async safeCall(hookName, fn) {
|
|
128
|
+
try {
|
|
129
|
+
await fn();
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
this.logger.warn(`[Matador] 🟡 Hook ${hookName} threw an error`, error);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import type { CheckpointClearedContext, CheckpointHitContext, CheckpointLoadedContext, CheckpointMissContext } from '../checkpoint/index.js';
|
|
2
|
+
import type { RetryDecision } from '../retry/index.js';
|
|
3
|
+
import type { ConnectionState, Transport } from '../transport/index.js';
|
|
4
|
+
import type { Envelope, SubscriberDefinition } from '../types/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Logger interface for Matador internal logging.
|
|
7
|
+
*/
|
|
8
|
+
export interface Logger {
|
|
9
|
+
debug(message: string, ...args: unknown[]): void;
|
|
10
|
+
info(message: string, ...args: unknown[]): void;
|
|
11
|
+
warn(message: string, ...args: unknown[]): void;
|
|
12
|
+
error(message: string, ...args: unknown[]): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Default logger that uses console.
|
|
16
|
+
*/
|
|
17
|
+
export declare const consoleLogger: Logger;
|
|
18
|
+
/**
|
|
19
|
+
* Context for enqueue success hook.
|
|
20
|
+
*/
|
|
21
|
+
export interface EnqueueSuccessContext {
|
|
22
|
+
readonly envelope: Envelope;
|
|
23
|
+
readonly queue: string;
|
|
24
|
+
/** The transport that was used (e.g., 'local', 'rabbitmq') */
|
|
25
|
+
readonly transport: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Context for enqueue warning hook (fallback used).
|
|
29
|
+
*/
|
|
30
|
+
export interface EnqueueWarningContext {
|
|
31
|
+
readonly envelope: Envelope;
|
|
32
|
+
readonly originalQueue: string;
|
|
33
|
+
readonly fallbackQueue: string;
|
|
34
|
+
readonly error: Error;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Context for transport fallback hook.
|
|
38
|
+
*/
|
|
39
|
+
export interface TransportFallbackContext {
|
|
40
|
+
/** The envelope that was being sent */
|
|
41
|
+
readonly envelope: Envelope;
|
|
42
|
+
/** The queue the message was being sent to */
|
|
43
|
+
readonly queue: string;
|
|
44
|
+
/** The transport that failed */
|
|
45
|
+
readonly failedTransport: Transport['name'];
|
|
46
|
+
/** The transport that will be tried next */
|
|
47
|
+
readonly nextTransport: Transport['name'];
|
|
48
|
+
/** The error from the failed transport */
|
|
49
|
+
readonly error: Error;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Context for enqueue error hook.
|
|
53
|
+
*/
|
|
54
|
+
export interface EnqueueErrorContext {
|
|
55
|
+
readonly envelope: Envelope;
|
|
56
|
+
readonly error: Error;
|
|
57
|
+
/** The transport that failed (e.g., 'local', 'rabbitmq') */
|
|
58
|
+
readonly transport: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Context for decode error hook.
|
|
62
|
+
*/
|
|
63
|
+
export interface DecodeErrorContext {
|
|
64
|
+
readonly error: Error;
|
|
65
|
+
readonly rawMessage: Uint8Array;
|
|
66
|
+
readonly sourceQueue: string;
|
|
67
|
+
/** The transport that received the message (e.g., 'local', 'rabbitmq') */
|
|
68
|
+
readonly transport: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Context for worker success hook.
|
|
72
|
+
*/
|
|
73
|
+
export interface WorkerSuccessContext {
|
|
74
|
+
readonly envelope: Envelope;
|
|
75
|
+
readonly subscriber: SubscriberDefinition;
|
|
76
|
+
readonly result: unknown;
|
|
77
|
+
readonly durationMs: number;
|
|
78
|
+
/** The transport that received the message (e.g., 'local', 'rabbitmq') */
|
|
79
|
+
readonly transport: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Context for worker error hook.
|
|
83
|
+
*/
|
|
84
|
+
export interface WorkerErrorContext {
|
|
85
|
+
readonly envelope: Envelope;
|
|
86
|
+
readonly subscriber: SubscriberDefinition;
|
|
87
|
+
readonly error: Error;
|
|
88
|
+
readonly durationMs: number;
|
|
89
|
+
readonly decision: RetryDecision;
|
|
90
|
+
/** The transport that received the message (e.g., 'local', 'rabbitmq') */
|
|
91
|
+
readonly transport: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Execution function passed to onWorkerWrap for APM wrapping.
|
|
95
|
+
*/
|
|
96
|
+
export type WorkerExecuteFn = () => Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* All available hooks for Matador.
|
|
99
|
+
*/
|
|
100
|
+
export interface MatadorHooks {
|
|
101
|
+
/**
|
|
102
|
+
* Logger for internal Matador logging.
|
|
103
|
+
* Defaults to console logger if not provided.
|
|
104
|
+
*/
|
|
105
|
+
logger?: Logger;
|
|
106
|
+
/**
|
|
107
|
+
* Called when an event is successfully enqueued.
|
|
108
|
+
*/
|
|
109
|
+
onEnqueueSuccess?(context: EnqueueSuccessContext): void | Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Called when enqueue falls back to a secondary queue.
|
|
112
|
+
*/
|
|
113
|
+
onEnqueueWarning?(context: EnqueueWarningContext): void | Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Called when transport fallback occurs during send.
|
|
116
|
+
* Only fires when using MultiTransport with fallbackEnabled=true.
|
|
117
|
+
*/
|
|
118
|
+
onTransportFallback?(context: TransportFallbackContext): void | Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Called when enqueue fails completely.
|
|
121
|
+
*/
|
|
122
|
+
onEnqueueError?(context: EnqueueErrorContext): void | Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Wraps entire worker processing (for APM context).
|
|
125
|
+
* Must call execute() to run the actual processing.
|
|
126
|
+
*/
|
|
127
|
+
onWorkerWrap?(envelope: Envelope, subscriber: SubscriberDefinition, execute: WorkerExecuteFn): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Called before processing begins.
|
|
130
|
+
*/
|
|
131
|
+
onWorkerBeforeProcess?(envelope: Envelope, subscriber: SubscriberDefinition): void | Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Called after successful processing.
|
|
134
|
+
*/
|
|
135
|
+
onWorkerSuccess?(context: WorkerSuccessContext): void | Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
* Called after processing error.
|
|
138
|
+
*/
|
|
139
|
+
onWorkerError?(context: WorkerErrorContext): void | Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Called when message decoding fails.
|
|
142
|
+
*/
|
|
143
|
+
onDecodeError?(context: DecodeErrorContext): void | Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Called when transport connection state changes.
|
|
146
|
+
*/
|
|
147
|
+
onConnectionStateChange?(state: ConnectionState): void | Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Loads universal metadata to add to all envelopes.
|
|
150
|
+
*/
|
|
151
|
+
loadUniversalMetadata?(): Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
152
|
+
/**
|
|
153
|
+
* Dynamic queue concurrency lookup.
|
|
154
|
+
*/
|
|
155
|
+
getQueueConcurrency?(queueName: string): number | undefined | Promise<number | undefined>;
|
|
156
|
+
/**
|
|
157
|
+
* Dynamic retry delay lookup.
|
|
158
|
+
*/
|
|
159
|
+
getRetryDelay?(envelope: Envelope, attemptNumber: number): number | undefined | Promise<number | undefined>;
|
|
160
|
+
/**
|
|
161
|
+
* Dynamic max attempts lookup.
|
|
162
|
+
*/
|
|
163
|
+
getAttempts?(envelope: Envelope): number | undefined | Promise<number | undefined>;
|
|
164
|
+
/**
|
|
165
|
+
* Dynamic max deliveries (poison threshold) lookup.
|
|
166
|
+
*/
|
|
167
|
+
getMaxDeliveries?(envelope: Envelope): number | undefined | Promise<number | undefined>;
|
|
168
|
+
/**
|
|
169
|
+
* Called when a checkpoint is loaded for a retry.
|
|
170
|
+
* Only fires for resumable subscribers on retry attempts.
|
|
171
|
+
*/
|
|
172
|
+
onCheckpointLoaded?(context: CheckpointLoadedContext): void | Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Called when an io() operation uses a cached value (checkpoint hit).
|
|
175
|
+
* Useful for observability and metrics.
|
|
176
|
+
*/
|
|
177
|
+
onCheckpointHit?(context: CheckpointHitContext): void | Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Called when an io() operation executes (cache miss).
|
|
180
|
+
* Useful for observability and metrics.
|
|
181
|
+
*/
|
|
182
|
+
onCheckpointMiss?(context: CheckpointMissContext): void | Promise<void>;
|
|
183
|
+
/**
|
|
184
|
+
* Called when a checkpoint is cleared.
|
|
185
|
+
* Fires on successful completion or when moving to dead-letter queue.
|
|
186
|
+
*/
|
|
187
|
+
onCheckpointCleared?(context: CheckpointClearedContext): void | Promise<void>;
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,E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AG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default logger that uses console.
|
|
3
|
+
*/
|
|
4
|
+
export const consoleLogger = {
|
|
5
|
+
debug: (message, ...args) => console.debug(message, ...args),
|
|
6
|
+
info: (message, ...args) => console.info(message, ...args),
|
|
7
|
+
warn: (message, ...args) => console.warn(message, ...args),
|
|
8
|
+
error: (message, ...args) => console.error(message, ...args),
|
|
9
|
+
};
|