atomic-queues 1.2.8 → 1.5.2
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 +363 -636
- package/dist/decorators/decorators.d.ts +123 -4
- package/dist/decorators/decorators.d.ts.map +1 -1
- package/dist/decorators/decorators.js +218 -10
- package/dist/decorators/decorators.js.map +1 -1
- package/dist/domain/interfaces.d.ts +127 -1
- package/dist/domain/interfaces.d.ts.map +1 -1
- package/dist/module/atomic-queues.module.d.ts.map +1 -1
- package/dist/module/atomic-queues.module.js +2 -0
- package/dist/module/atomic-queues.module.js.map +1 -1
- package/dist/services/cron-manager/cron-manager.service.d.ts +23 -1
- package/dist/services/cron-manager/cron-manager.service.d.ts.map +1 -1
- package/dist/services/cron-manager/cron-manager.service.js +150 -41
- package/dist/services/cron-manager/cron-manager.service.js.map +1 -1
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +2 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/processor-discovery/processor-discovery.service.d.ts +49 -4
- package/dist/services/processor-discovery/processor-discovery.service.d.ts.map +1 -1
- package/dist/services/processor-discovery/processor-discovery.service.js +262 -14
- package/dist/services/processor-discovery/processor-discovery.service.js.map +1 -1
- package/dist/services/queue-bus/queue-bus.service.d.ts +126 -12
- package/dist/services/queue-bus/queue-bus.service.d.ts.map +1 -1
- package/dist/services/queue-bus/queue-bus.service.js +274 -22
- package/dist/services/queue-bus/queue-bus.service.js.map +1 -1
- package/dist/services/queue-events-manager/index.d.ts +2 -0
- package/dist/services/queue-events-manager/index.d.ts.map +1 -0
- package/dist/services/queue-events-manager/index.js +18 -0
- package/dist/services/queue-events-manager/index.js.map +1 -0
- package/dist/services/queue-events-manager/queue-events-manager.service.d.ts +124 -0
- package/dist/services/queue-events-manager/queue-events-manager.service.d.ts.map +1 -0
- package/dist/services/queue-events-manager/queue-events-manager.service.js +355 -0
- package/dist/services/queue-events-manager/queue-events-manager.service.js.map +1 -0
- package/dist/services/queue-manager/queue-manager.service.d.ts +15 -1
- package/dist/services/queue-manager/queue-manager.service.d.ts.map +1 -1
- package/dist/services/queue-manager/queue-manager.service.js +17 -3
- package/dist/services/queue-manager/queue-manager.service.js.map +1 -1
- package/dist/services/spawn-queue/index.d.ts +2 -0
- package/dist/services/spawn-queue/index.d.ts.map +1 -0
- package/dist/services/spawn-queue/index.js +18 -0
- package/dist/services/spawn-queue/index.js.map +1 -0
- package/dist/services/spawn-queue/spawn-queue.service.d.ts +119 -0
- package/dist/services/spawn-queue/spawn-queue.service.d.ts.map +1 -0
- package/dist/services/spawn-queue/spawn-queue.service.js +273 -0
- package/dist/services/spawn-queue/spawn-queue.service.js.map +1 -0
- package/dist/services/worker-manager/worker-manager.service.d.ts +59 -1
- package/dist/services/worker-manager/worker-manager.service.d.ts.map +1 -1
- package/dist/services/worker-manager/worker-manager.service.js +142 -12
- package/dist/services/worker-manager/worker-manager.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ import { IWorkerConfig } from '../domain';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const ATOMIC_PROCESSOR_METADATA = "atomic:processor";
|
|
7
7
|
export declare const ENTITY_TYPE_METADATA = "atomic:entity-type";
|
|
8
|
+
export declare const ENTITY_ID_METADATA = "atomic:entity-id";
|
|
8
9
|
export declare const JOB_TYPE_METADATA = "atomic:job-type";
|
|
9
10
|
export declare const WORKER_PROCESSOR_METADATA = "atomic:worker-processor";
|
|
10
11
|
export declare const JOB_HANDLER_METADATA = "atomic:job-handler";
|
|
@@ -21,12 +22,36 @@ export declare const JOB_QUERY_METADATA = "atomic:job-query";
|
|
|
21
22
|
export interface WorkerProcessorOptions {
|
|
22
23
|
/** Entity type this processor handles (e.g., 'table', 'user') */
|
|
23
24
|
entityType: string;
|
|
25
|
+
/** Default property name for entity ID extraction (optional) */
|
|
26
|
+
defaultEntityId?: string;
|
|
24
27
|
/** Function to generate queue name from entityId */
|
|
25
28
|
queueName?: string | ((entityId: string) => string);
|
|
26
29
|
/** Function to generate worker name from entityId */
|
|
27
30
|
workerName?: string | ((entityId: string) => string);
|
|
28
31
|
/** Worker configuration */
|
|
29
32
|
workerConfig?: IWorkerConfig;
|
|
33
|
+
/**
|
|
34
|
+
* If true, workerConfig fully replaces module workerDefaults (no merge).
|
|
35
|
+
* If false (default), workerConfig is merged with workerDefaults.
|
|
36
|
+
*/
|
|
37
|
+
overrideDefaults?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Maximum workers per entity (default: 1).
|
|
40
|
+
* Used when operating without an EntityScaler.
|
|
41
|
+
*/
|
|
42
|
+
maxWorkersPerEntity?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Idle timeout in seconds before a worker is considered idle and can be terminated.
|
|
45
|
+
* Workers self-report idle time via heartbeat. Default: 15 seconds.
|
|
46
|
+
* Used when operating without an EntityScaler.
|
|
47
|
+
*/
|
|
48
|
+
idleTimeoutSeconds?: number;
|
|
49
|
+
/**
|
|
50
|
+
* If true, workers are automatically spawned when jobs arrive (scalerless mode).
|
|
51
|
+
* When enabled, no @EntityScaler is required - workers spawn on job arrival
|
|
52
|
+
* and terminate when idle. Default: true if no EntityScaler is registered.
|
|
53
|
+
*/
|
|
54
|
+
autoSpawn?: boolean;
|
|
30
55
|
}
|
|
31
56
|
/**
|
|
32
57
|
* Options for @EntityScaler decorator
|
|
@@ -36,6 +61,11 @@ export interface EntityScalerOptions {
|
|
|
36
61
|
entityType: string;
|
|
37
62
|
/** Maximum workers per entity */
|
|
38
63
|
maxWorkersPerEntity?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Idle timeout in seconds before a worker is considered idle and can be terminated.
|
|
66
|
+
* Workers self-report idle time via heartbeat. Default: 15 seconds.
|
|
67
|
+
*/
|
|
68
|
+
idleTimeoutSeconds?: number;
|
|
39
69
|
}
|
|
40
70
|
/**
|
|
41
71
|
* Options for @JobCommand decorator
|
|
@@ -92,9 +122,11 @@ export interface JobHandlerMetadata {
|
|
|
92
122
|
*/
|
|
93
123
|
export interface WorkerProcessorMetadata {
|
|
94
124
|
entityType: string;
|
|
125
|
+
defaultEntityId?: string;
|
|
95
126
|
queueNameFn: (entityId: string) => string;
|
|
96
127
|
workerNameFn: (entityId: string) => string;
|
|
97
128
|
workerConfig: IWorkerConfig;
|
|
129
|
+
overrideDefaults: boolean;
|
|
98
130
|
targetClass: Type<any>;
|
|
99
131
|
jobHandlers: Map<string, JobHandlerMetadata>;
|
|
100
132
|
wildcardHandler?: JobHandlerMetadata;
|
|
@@ -132,13 +164,100 @@ export interface EntityScalerMetadata {
|
|
|
132
164
|
*/
|
|
133
165
|
export declare const AtomicProcessor: (jobType: string) => MethodDecorator;
|
|
134
166
|
/**
|
|
135
|
-
* @EntityType decorator
|
|
167
|
+
* @EntityType decorator
|
|
168
|
+
*
|
|
169
|
+
* Marks a command/query class with its entity type for automatic routing.
|
|
170
|
+
* When present, queueBus.enqueue(cmd) can auto-route without forEntity().
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* @EntityType('account')
|
|
175
|
+
* export class WithdrawCommand {
|
|
176
|
+
* @QueueEntityId()
|
|
177
|
+
* public readonly accountId: string;
|
|
178
|
+
* public readonly amount: number;
|
|
179
|
+
* }
|
|
180
|
+
*
|
|
181
|
+
* // Can now use direct enqueue:
|
|
182
|
+
* await queueBus.enqueue(new WithdrawCommand(accountId, amount));
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
export declare function EntityType(entityType: string): ClassDecorator;
|
|
186
|
+
/**
|
|
187
|
+
* @QueueEntityId decorator
|
|
136
188
|
*
|
|
137
|
-
* Marks a
|
|
189
|
+
* Marks a property OR constructor parameter as the entity ID for queue routing.
|
|
190
|
+
* Only ONE @QueueEntityId() allowed per class (enforced at decoration time).
|
|
191
|
+
* Overrides module-level defaultEntityId configuration.
|
|
138
192
|
*
|
|
139
|
-
* @
|
|
193
|
+
* @example Property decorator:
|
|
194
|
+
* ```typescript
|
|
195
|
+
* export class TransferCommand {
|
|
196
|
+
* @QueueEntityId()
|
|
197
|
+
* public readonly sourceAccountId: string;
|
|
198
|
+
* public readonly amount: number;
|
|
199
|
+
* }
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* @example Parameter decorator (recommended):
|
|
203
|
+
* ```typescript
|
|
204
|
+
* @QueueEntity('account')
|
|
205
|
+
* export class TransferCommand {
|
|
206
|
+
* constructor(
|
|
207
|
+
* @QueueEntityId() public readonly sourceAccountId: string,
|
|
208
|
+
* public readonly amount: number,
|
|
209
|
+
* ) {}
|
|
210
|
+
* }
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
export declare function QueueEntityId(): PropertyDecorator & ParameterDecorator;
|
|
214
|
+
/**
|
|
215
|
+
* @deprecated Use @QueueEntityId() instead. This alias is provided for backwards compatibility.
|
|
216
|
+
*/
|
|
217
|
+
export declare const EntityId: typeof QueueEntityId;
|
|
218
|
+
/**
|
|
219
|
+
* Get the entity type from a command/query class decorated with @EntityType or @QueueEntity
|
|
220
|
+
*/
|
|
221
|
+
export declare function getEntityType(target: Function): string | undefined;
|
|
222
|
+
/**
|
|
223
|
+
* Get the entity ID property name from a class decorated with @QueueEntityId or @QueueEntity
|
|
224
|
+
*/
|
|
225
|
+
export declare function getEntityIdProperty(target: Function): string | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* @QueueEntity decorator
|
|
228
|
+
*
|
|
229
|
+
* Single decorator that combines @EntityType and @QueueEntityId into one.
|
|
230
|
+
* This is the recommended way to mark commands/queries for queue routing.
|
|
231
|
+
*
|
|
232
|
+
* @param entityType - The entity type for routing (e.g., 'table', 'account')
|
|
233
|
+
* @param entityIdProperty - Optional property name containing the entity ID.
|
|
234
|
+
* If omitted, uses module-level defaultEntityId from entities config.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* // With explicit property name:
|
|
238
|
+
* @QueueEntity('table', 'tableId')
|
|
239
|
+
* export class MakeBetCommand {
|
|
240
|
+
* constructor(
|
|
241
|
+
* public readonly tableId: string, // ← unchanged!
|
|
242
|
+
* public readonly amount: number,
|
|
243
|
+
* ) {}
|
|
244
|
+
* }
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* // Using module default (entities config has defaultEntityId: 'tableId'):
|
|
248
|
+
* @QueueEntity('table')
|
|
249
|
+
* export class DealCommand {
|
|
250
|
+
* constructor(
|
|
251
|
+
* public readonly tableId: string,
|
|
252
|
+
* public readonly card: string,
|
|
253
|
+
* ) {}
|
|
254
|
+
* }
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* // Then just enqueue directly:
|
|
258
|
+
* await queueBus.enqueue(new MakeBetCommand(tableId, 100));
|
|
140
259
|
*/
|
|
141
|
-
export declare
|
|
260
|
+
export declare function QueueEntity(entityType: string, entityIdProperty?: string): ClassDecorator;
|
|
142
261
|
/**
|
|
143
262
|
* @JobType decorator (LEGACY)
|
|
144
263
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/decorators/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAM1C;;GAEG;AACH,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAC5D,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AACzD,eAAO,MAAM,iBAAiB,oBAAoB,CAAC;AACnD,eAAO,MAAM,yBAAyB,4BAA4B,CAAC;AACnE,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AACzD,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAC7D,eAAO,MAAM,4BAA4B,+BAA+B,CAAC;AACzE,eAAO,MAAM,iCAAiC,oCAAoC,CAAC;AACnF,eAAO,MAAM,wBAAwB,2BAA2B,CAAC;AACjE,eAAO,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mB/E;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,cAAc,CAmB3E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,GAAG,kBAAkB,GAAG,SAAS,CAEtF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,GAAG,gBAAgB,GAAG,SAAS,CAElF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAEtD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAEpD;AAMD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,sBAAsB,GAAG,SAAS,CAEhG;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,kBAAkB,EAAE,CAE7E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,mBAAmB,GAAG,SAAS,CAE1F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAE5D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAEzD"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InjectAtomicQueue = exports.JobType = exports.
|
|
3
|
+
exports.InjectAtomicQueue = exports.JobType = exports.EntityId = exports.AtomicProcessor = exports.JOB_QUERY_METADATA = exports.JOB_COMMAND_METADATA = exports.ON_TERMINATE_WORKER_METADATA = exports.ON_SPAWN_WORKER_METADATA = exports.GET_DESIRED_WORKER_COUNT_METADATA = exports.GET_ACTIVE_ENTITIES_METADATA = exports.ENTITY_SCALER_METADATA = exports.JOB_HANDLER_METADATA = exports.WORKER_PROCESSOR_METADATA = exports.JOB_TYPE_METADATA = exports.ENTITY_ID_METADATA = exports.ENTITY_TYPE_METADATA = exports.ATOMIC_PROCESSOR_METADATA = void 0;
|
|
4
|
+
exports.EntityType = EntityType;
|
|
5
|
+
exports.QueueEntityId = QueueEntityId;
|
|
6
|
+
exports.getEntityType = getEntityType;
|
|
7
|
+
exports.getEntityIdProperty = getEntityIdProperty;
|
|
8
|
+
exports.QueueEntity = QueueEntity;
|
|
4
9
|
exports.WorkerProcessor = WorkerProcessor;
|
|
5
10
|
exports.JobHandler = JobHandler;
|
|
6
11
|
exports.EntityScaler = EntityScaler;
|
|
@@ -28,6 +33,7 @@ const common_1 = require("@nestjs/common");
|
|
|
28
33
|
*/
|
|
29
34
|
exports.ATOMIC_PROCESSOR_METADATA = 'atomic:processor';
|
|
30
35
|
exports.ENTITY_TYPE_METADATA = 'atomic:entity-type';
|
|
36
|
+
exports.ENTITY_ID_METADATA = 'atomic:entity-id';
|
|
31
37
|
exports.JOB_TYPE_METADATA = 'atomic:job-type';
|
|
32
38
|
exports.WORKER_PROCESSOR_METADATA = 'atomic:worker-processor';
|
|
33
39
|
exports.JOB_HANDLER_METADATA = 'atomic:job-handler';
|
|
@@ -38,6 +44,8 @@ exports.ON_SPAWN_WORKER_METADATA = 'atomic:on-spawn-worker';
|
|
|
38
44
|
exports.ON_TERMINATE_WORKER_METADATA = 'atomic:on-terminate-worker';
|
|
39
45
|
exports.JOB_COMMAND_METADATA = 'atomic:job-command';
|
|
40
46
|
exports.JOB_QUERY_METADATA = 'atomic:job-query';
|
|
47
|
+
// Registry to track @QueueEntityId usage per class (for duplicate detection)
|
|
48
|
+
const queueEntityIdRegistry = new Map();
|
|
41
49
|
// =============================================================================
|
|
42
50
|
// LEGACY DECORATORS (Preserved for backward compatibility)
|
|
43
51
|
// =============================================================================
|
|
@@ -65,16 +73,212 @@ const AtomicProcessor = (jobType) => {
|
|
|
65
73
|
};
|
|
66
74
|
exports.AtomicProcessor = AtomicProcessor;
|
|
67
75
|
/**
|
|
68
|
-
* @EntityType decorator
|
|
76
|
+
* @EntityType decorator
|
|
77
|
+
*
|
|
78
|
+
* Marks a command/query class with its entity type for automatic routing.
|
|
79
|
+
* When present, queueBus.enqueue(cmd) can auto-route without forEntity().
|
|
69
80
|
*
|
|
70
|
-
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* @EntityType('account')
|
|
84
|
+
* export class WithdrawCommand {
|
|
85
|
+
* @QueueEntityId()
|
|
86
|
+
* public readonly accountId: string;
|
|
87
|
+
* public readonly amount: number;
|
|
88
|
+
* }
|
|
71
89
|
*
|
|
72
|
-
*
|
|
90
|
+
* // Can now use direct enqueue:
|
|
91
|
+
* await queueBus.enqueue(new WithdrawCommand(accountId, amount));
|
|
92
|
+
* ```
|
|
73
93
|
*/
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
|
|
77
|
-
|
|
94
|
+
function EntityType(entityType) {
|
|
95
|
+
return (target) => {
|
|
96
|
+
Reflect.defineMetadata(exports.ENTITY_TYPE_METADATA, entityType, target);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @QueueEntityId decorator
|
|
101
|
+
*
|
|
102
|
+
* Marks a property OR constructor parameter as the entity ID for queue routing.
|
|
103
|
+
* Only ONE @QueueEntityId() allowed per class (enforced at decoration time).
|
|
104
|
+
* Overrides module-level defaultEntityId configuration.
|
|
105
|
+
*
|
|
106
|
+
* @example Property decorator:
|
|
107
|
+
* ```typescript
|
|
108
|
+
* export class TransferCommand {
|
|
109
|
+
* @QueueEntityId()
|
|
110
|
+
* public readonly sourceAccountId: string;
|
|
111
|
+
* public readonly amount: number;
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @example Parameter decorator (recommended):
|
|
116
|
+
* ```typescript
|
|
117
|
+
* @QueueEntity('account')
|
|
118
|
+
* export class TransferCommand {
|
|
119
|
+
* constructor(
|
|
120
|
+
* @QueueEntityId() public readonly sourceAccountId: string,
|
|
121
|
+
* public readonly amount: number,
|
|
122
|
+
* ) {}
|
|
123
|
+
* }
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
function QueueEntityId() {
|
|
127
|
+
return (target, propertyKey, parameterIndex) => {
|
|
128
|
+
// Parameter decorator case (on constructor param)
|
|
129
|
+
if (typeof parameterIndex === 'number') {
|
|
130
|
+
const constructor = target;
|
|
131
|
+
const className = constructor.name;
|
|
132
|
+
// Extract parameter name from constructor
|
|
133
|
+
const paramName = getConstructorParamName(constructor, parameterIndex);
|
|
134
|
+
if (!paramName) {
|
|
135
|
+
throw new Error(`Cannot determine parameter name at index ${parameterIndex} in ${className}. ` +
|
|
136
|
+
`Ensure you're using 'public readonly paramName' syntax.`);
|
|
137
|
+
}
|
|
138
|
+
// Check for duplicate
|
|
139
|
+
const existing = queueEntityIdRegistry.get(constructor);
|
|
140
|
+
if (existing) {
|
|
141
|
+
throw new Error(`Multiple @QueueEntityId() decorators on ${className}. ` +
|
|
142
|
+
`Found on '${existing}' and '${paramName}'. ` +
|
|
143
|
+
`Only one parameter/property can be the entity ID.`);
|
|
144
|
+
}
|
|
145
|
+
queueEntityIdRegistry.set(constructor, paramName);
|
|
146
|
+
Reflect.defineMetadata(exports.ENTITY_ID_METADATA, paramName, constructor);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
// Property decorator case (on class property)
|
|
150
|
+
const constructor = target.constructor;
|
|
151
|
+
const className = constructor.name;
|
|
152
|
+
const propName = String(propertyKey);
|
|
153
|
+
// Check for duplicate @QueueEntityId on same class
|
|
154
|
+
const existing = queueEntityIdRegistry.get(constructor);
|
|
155
|
+
if (existing) {
|
|
156
|
+
throw new Error(`Multiple @QueueEntityId() decorators on ${className}. ` +
|
|
157
|
+
`Found on '${existing}' and '${propName}'. ` +
|
|
158
|
+
`Only one property can be the entity ID.`);
|
|
159
|
+
}
|
|
160
|
+
queueEntityIdRegistry.set(constructor, propName);
|
|
161
|
+
Reflect.defineMetadata(exports.ENTITY_ID_METADATA, propName, constructor);
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @deprecated Use @QueueEntityId() instead. This alias is provided for backwards compatibility.
|
|
166
|
+
*/
|
|
167
|
+
exports.EntityId = QueueEntityId;
|
|
168
|
+
/**
|
|
169
|
+
* Extract parameter name from constructor function by parsing its string representation.
|
|
170
|
+
* Works with TypeScript's 'public readonly paramName' shorthand.
|
|
171
|
+
*/
|
|
172
|
+
function getConstructorParamName(constructor, index) {
|
|
173
|
+
const fnStr = constructor.toString();
|
|
174
|
+
// Match constructor parameters - handles various formats
|
|
175
|
+
const constructorMatch = fnStr.match(/constructor\s*\(([^)]*)\)/);
|
|
176
|
+
if (!constructorMatch)
|
|
177
|
+
return undefined;
|
|
178
|
+
const paramsStr = constructorMatch[1];
|
|
179
|
+
if (!paramsStr.trim())
|
|
180
|
+
return undefined;
|
|
181
|
+
// Split by comma, but be careful with nested generics/objects
|
|
182
|
+
const params = splitParams(paramsStr);
|
|
183
|
+
if (index >= params.length)
|
|
184
|
+
return undefined;
|
|
185
|
+
const param = params[index].trim();
|
|
186
|
+
// Extract the actual parameter name, handling:
|
|
187
|
+
// - @Decorator() public readonly paramName: Type
|
|
188
|
+
// - public readonly paramName: Type
|
|
189
|
+
// - paramName: Type
|
|
190
|
+
// - paramName
|
|
191
|
+
const nameMatch = param.match(/(?:@\w+\([^)]*\)\s*)*(?:public\s+)?(?:readonly\s+)?(\w+)/);
|
|
192
|
+
return nameMatch ? nameMatch[1] : undefined;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Split parameter string by commas, respecting nested structures
|
|
196
|
+
*/
|
|
197
|
+
function splitParams(paramsStr) {
|
|
198
|
+
const params = [];
|
|
199
|
+
let current = '';
|
|
200
|
+
let depth = 0;
|
|
201
|
+
for (const char of paramsStr) {
|
|
202
|
+
if (char === '(' || char === '<' || char === '{' || char === '[') {
|
|
203
|
+
depth++;
|
|
204
|
+
current += char;
|
|
205
|
+
}
|
|
206
|
+
else if (char === ')' || char === '>' || char === '}' || char === ']') {
|
|
207
|
+
depth--;
|
|
208
|
+
current += char;
|
|
209
|
+
}
|
|
210
|
+
else if (char === ',' && depth === 0) {
|
|
211
|
+
params.push(current);
|
|
212
|
+
current = '';
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
current += char;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (current.trim()) {
|
|
219
|
+
params.push(current);
|
|
220
|
+
}
|
|
221
|
+
return params;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Get the entity type from a command/query class decorated with @EntityType or @QueueEntity
|
|
225
|
+
*/
|
|
226
|
+
function getEntityType(target) {
|
|
227
|
+
return Reflect.getMetadata(exports.ENTITY_TYPE_METADATA, target);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Get the entity ID property name from a class decorated with @QueueEntityId or @QueueEntity
|
|
231
|
+
*/
|
|
232
|
+
function getEntityIdProperty(target) {
|
|
233
|
+
return Reflect.getMetadata(exports.ENTITY_ID_METADATA, target);
|
|
234
|
+
}
|
|
235
|
+
// =============================================================================
|
|
236
|
+
// NEW COMBINED DECORATOR - Less Invasive
|
|
237
|
+
// =============================================================================
|
|
238
|
+
/**
|
|
239
|
+
* @QueueEntity decorator
|
|
240
|
+
*
|
|
241
|
+
* Single decorator that combines @EntityType and @QueueEntityId into one.
|
|
242
|
+
* This is the recommended way to mark commands/queries for queue routing.
|
|
243
|
+
*
|
|
244
|
+
* @param entityType - The entity type for routing (e.g., 'table', 'account')
|
|
245
|
+
* @param entityIdProperty - Optional property name containing the entity ID.
|
|
246
|
+
* If omitted, uses module-level defaultEntityId from entities config.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* // With explicit property name:
|
|
250
|
+
* @QueueEntity('table', 'tableId')
|
|
251
|
+
* export class MakeBetCommand {
|
|
252
|
+
* constructor(
|
|
253
|
+
* public readonly tableId: string, // ← unchanged!
|
|
254
|
+
* public readonly amount: number,
|
|
255
|
+
* ) {}
|
|
256
|
+
* }
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* // Using module default (entities config has defaultEntityId: 'tableId'):
|
|
260
|
+
* @QueueEntity('table')
|
|
261
|
+
* export class DealCommand {
|
|
262
|
+
* constructor(
|
|
263
|
+
* public readonly tableId: string,
|
|
264
|
+
* public readonly card: string,
|
|
265
|
+
* ) {}
|
|
266
|
+
* }
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* // Then just enqueue directly:
|
|
270
|
+
* await queueBus.enqueue(new MakeBetCommand(tableId, 100));
|
|
271
|
+
*/
|
|
272
|
+
function QueueEntity(entityType, entityIdProperty) {
|
|
273
|
+
return (target) => {
|
|
274
|
+
// Always set entity type
|
|
275
|
+
Reflect.defineMetadata(exports.ENTITY_TYPE_METADATA, entityType, target);
|
|
276
|
+
// Set entity ID property if provided (otherwise falls back to module config)
|
|
277
|
+
if (entityIdProperty) {
|
|
278
|
+
Reflect.defineMetadata(exports.ENTITY_ID_METADATA, entityIdProperty, target);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
}
|
|
78
282
|
/**
|
|
79
283
|
* @JobType decorator (LEGACY)
|
|
80
284
|
*
|
|
@@ -143,8 +347,12 @@ exports.InjectAtomicQueue = InjectAtomicQueue;
|
|
|
143
347
|
*/
|
|
144
348
|
function WorkerProcessor(options) {
|
|
145
349
|
return (target) => {
|
|
146
|
-
// Store the options
|
|
147
|
-
|
|
350
|
+
// Store the options with defaults
|
|
351
|
+
const metadata = {
|
|
352
|
+
...options,
|
|
353
|
+
overrideDefaults: options.overrideDefaults ?? false,
|
|
354
|
+
};
|
|
355
|
+
Reflect.defineMetadata(exports.WORKER_PROCESSOR_METADATA, metadata, target);
|
|
148
356
|
// Mark as injectable if not already
|
|
149
357
|
if (!Reflect.hasMetadata('injectable', target)) {
|
|
150
358
|
Reflect.defineMetadata('injectable', true, target);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/decorators/decorators.ts"],"names":[],"mappings":";;;AA4PA,0CAUC;AAsBD,gCAyBC;AAoCD,oCAQC;AAQD,8CAcC;AAQD,sDAcC;AAQD,sCAcC;AAQD,8CAcC;AAiFD,gCAmBC;AAwBD,4BAmBC;AAKD,sDAEC;AAKD,kDAEC;AAKD,oCAEC;AAKD,gCAEC;AASD,gEAEC;AAKD,sDAEC;AAKD,0DAEC;AAKD,8CAEC;AAKD,wCAEC;AA3oBD,2CAAmD;AAGnD,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF;;GAEG;AACU,QAAA,yBAAyB,GAAG,kBAAkB,CAAC;AAC/C,QAAA,oBAAoB,GAAG,oBAAoB,CAAC;AAC5C,QAAA,iBAAiB,GAAG,iBAAiB,CAAC;AACtC,QAAA,yBAAyB,GAAG,yBAAyB,CAAC;AACtD,QAAA,oBAAoB,GAAG,oBAAoB,CAAC;AAC5C,QAAA,sBAAsB,GAAG,sBAAsB,CAAC;AAChD,QAAA,4BAA4B,GAAG,4BAA4B,CAAC;AAC5D,QAAA,iCAAiC,GAAG,iCAAiC,CAAC;AACtE,QAAA,wBAAwB,GAAG,wBAAwB,CAAC;AACpD,QAAA,4BAA4B,GAAG,4BAA4B,CAAC;AAC5D,QAAA,oBAAoB,GAAG,oBAAoB,CAAC;AAC5C,QAAA,kBAAkB,GAAG,kBAAkB,CAAC;AA+GrD,gFAAgF;AAChF,2DAA2D;AAC3D,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,eAAe,GAAG,CAAC,OAAe,EAAmB,EAAE;I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7D,CAAC"}
|
|
@@ -87,6 +87,68 @@ export interface IServiceQueueConfig {
|
|
|
87
87
|
/** Custom worker name (default: {keyPrefix}-service-worker) */
|
|
88
88
|
workerName?: string;
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Entity-specific configuration for per-entity queue defaults
|
|
92
|
+
* Used in module-level `entities` config to define defaults per entity type.
|
|
93
|
+
*
|
|
94
|
+
* When configured in the module, entities automatically get:
|
|
95
|
+
* - Worker spawning when jobs arrive (via QueueEvents)
|
|
96
|
+
* - Idle worker termination (via CronManager)
|
|
97
|
+
* - Job routing via CQRS CommandBus/QueryBus
|
|
98
|
+
*
|
|
99
|
+
* No @WorkerProcessor class needed!
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* AtomicQueuesModule.forRoot({
|
|
104
|
+
* redis: { host: 'localhost', port: 6379 },
|
|
105
|
+
* enableCronManager: true,
|
|
106
|
+
* entities: {
|
|
107
|
+
* account: {
|
|
108
|
+
* queueName: (id) => `${id}-queue`,
|
|
109
|
+
* workerName: (id) => `${id}-worker`,
|
|
110
|
+
* maxWorkersPerEntity: 1,
|
|
111
|
+
* idleTimeoutSeconds: 15,
|
|
112
|
+
* },
|
|
113
|
+
* },
|
|
114
|
+
* })
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export interface IEntityConfig {
|
|
118
|
+
/**
|
|
119
|
+
* Default property name to use for entity ID extraction.
|
|
120
|
+
* This is used when commands don't have an @QueueEntityId() decorator.
|
|
121
|
+
* Example: 'tableId', 'accountId', 'userId'
|
|
122
|
+
*/
|
|
123
|
+
defaultEntityId?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Custom queue name generator for this entity type.
|
|
126
|
+
* If not provided, uses: {keyPrefix}:{entityType}:{entityId}:queue
|
|
127
|
+
*/
|
|
128
|
+
queueName?: (entityId: string) => string;
|
|
129
|
+
/**
|
|
130
|
+
* Custom worker name generator for this entity type.
|
|
131
|
+
* If not provided, uses: {keyPrefix}:{entityType}:{entityId}:worker
|
|
132
|
+
*/
|
|
133
|
+
workerName?: (entityId: string) => string;
|
|
134
|
+
/** Worker configuration overrides for this entity type */
|
|
135
|
+
workerConfig?: Partial<IWorkerConfig>;
|
|
136
|
+
/**
|
|
137
|
+
* Maximum workers per entity (default: 1).
|
|
138
|
+
* Determines how many concurrent workers can process jobs for a single entity.
|
|
139
|
+
*/
|
|
140
|
+
maxWorkersPerEntity?: number;
|
|
141
|
+
/**
|
|
142
|
+
* Idle timeout in seconds before a worker is terminated (default: 15).
|
|
143
|
+
* Workers are terminated when they have no jobs to process for this duration.
|
|
144
|
+
*/
|
|
145
|
+
idleTimeoutSeconds?: number;
|
|
146
|
+
/**
|
|
147
|
+
* If true, workers are automatically spawned when jobs arrive (default: true).
|
|
148
|
+
* When enabled, no @WorkerProcessor or @EntityScaler is required.
|
|
149
|
+
*/
|
|
150
|
+
autoSpawn?: boolean;
|
|
151
|
+
}
|
|
90
152
|
/**
|
|
91
153
|
* Main module configuration
|
|
92
154
|
*/
|
|
@@ -113,6 +175,32 @@ export interface IAtomicQueuesModuleConfig {
|
|
|
113
175
|
* are automatically discovered and registered with QueueBus.
|
|
114
176
|
*/
|
|
115
177
|
autoRegisterCommands?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Per-entity type configuration.
|
|
180
|
+
* Allows setting defaults for specific entity types (e.g., 'table', 'account').
|
|
181
|
+
* These defaults are merged with processor-level and command-level settings.
|
|
182
|
+
*
|
|
183
|
+
* Priority chain (highest to lowest):
|
|
184
|
+
* 1. @QueueEntityId() decorator on command property
|
|
185
|
+
* 2. @WorkerProcessor({ defaultEntityId })
|
|
186
|
+
* 3. entities[entityType].defaultEntityId
|
|
187
|
+
* 4. Error (no fallback to magic extraction)
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* entities: {
|
|
192
|
+
* table: {
|
|
193
|
+
* defaultEntityId: 'tableId',
|
|
194
|
+
* workerConfig: { concurrency: 1 }
|
|
195
|
+
* },
|
|
196
|
+
* account: {
|
|
197
|
+
* defaultEntityId: 'accountId',
|
|
198
|
+
* queueName: (id) => `accounts-${id}-queue`
|
|
199
|
+
* }
|
|
200
|
+
* }
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
entities?: Record<string, IEntityConfig>;
|
|
116
204
|
}
|
|
117
205
|
/**
|
|
118
206
|
* Represents a managed queue instance
|
|
@@ -201,9 +289,13 @@ export interface IWorkerManager {
|
|
|
201
289
|
*/
|
|
202
290
|
createWorker(options: IWorkerCreationOptions): Promise<Worker>;
|
|
203
291
|
/**
|
|
204
|
-
* Check if a worker exists and is alive
|
|
292
|
+
* Check if a worker exists and is alive (across ALL nodes)
|
|
205
293
|
*/
|
|
206
294
|
workerExists(workerName: string): Promise<boolean>;
|
|
295
|
+
/**
|
|
296
|
+
* Check if a worker exists on THIS node specifically
|
|
297
|
+
*/
|
|
298
|
+
workerExistsOnThisNode(workerName: string): Promise<boolean>;
|
|
207
299
|
/**
|
|
208
300
|
* Get all running workers for current node
|
|
209
301
|
*/
|
|
@@ -240,6 +332,35 @@ export interface IWorkerManager {
|
|
|
240
332
|
* Get the node ID for this instance
|
|
241
333
|
*/
|
|
242
334
|
getNodeId(): string;
|
|
335
|
+
/**
|
|
336
|
+
* Mark that a worker has completed a job (resets idle counter).
|
|
337
|
+
* Called internally when job completes.
|
|
338
|
+
*/
|
|
339
|
+
markWorkerActive(workerName: string): void;
|
|
340
|
+
/**
|
|
341
|
+
* Get the idle seconds counter for a worker.
|
|
342
|
+
* This is incremented by the heartbeat and reset when a job completes.
|
|
343
|
+
*/
|
|
344
|
+
getWorkerIdleSeconds(workerName: string): Promise<number>;
|
|
345
|
+
/**
|
|
346
|
+
* Reset the idle counter for a worker (called when job completes).
|
|
347
|
+
*/
|
|
348
|
+
resetWorkerIdleCounter(workerName: string): Promise<void>;
|
|
349
|
+
/**
|
|
350
|
+
* Increment the idle counter for a worker (called by heartbeat).
|
|
351
|
+
* Returns the new idle seconds value.
|
|
352
|
+
*/
|
|
353
|
+
incrementWorkerIdleCounter(workerName: string, incrementBy?: number): Promise<number>;
|
|
354
|
+
/**
|
|
355
|
+
* Remove the idle counter for a worker (cleanup).
|
|
356
|
+
*/
|
|
357
|
+
removeWorkerIdleCounter(workerName: string): Promise<void>;
|
|
358
|
+
/**
|
|
359
|
+
* Check if a worker is idle based on threshold.
|
|
360
|
+
* @param workerName - Worker name
|
|
361
|
+
* @param thresholdSeconds - Idle threshold in seconds (default: 15)
|
|
362
|
+
*/
|
|
363
|
+
isWorkerIdle(workerName: string, thresholdSeconds?: number): Promise<boolean>;
|
|
243
364
|
}
|
|
244
365
|
/**
|
|
245
366
|
* Lock state for a resource
|
|
@@ -390,6 +511,11 @@ export interface IEntityScalingConfig {
|
|
|
390
511
|
getActiveEntityIds: () => Promise<string[]>;
|
|
391
512
|
/** Maximum workers per entity */
|
|
392
513
|
maxWorkersPerEntity?: number;
|
|
514
|
+
/**
|
|
515
|
+
* Idle timeout in seconds before a worker is considered idle and can be terminated.
|
|
516
|
+
* Workers self-report idle time via heartbeat. Default: 15 seconds.
|
|
517
|
+
*/
|
|
518
|
+
idleTimeoutSeconds?: number;
|
|
393
519
|
/** Function called when spawning a worker */
|
|
394
520
|
onSpawnWorker?: (entityId: string) => Promise<void>;
|
|
395
521
|
/** Function called when terminating a worker */
|