@spinajs/queue 2.0.180 → 2.0.182
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/lib/cjs/BlackHoleQueueClient.d.ts +11 -11
- package/lib/cjs/BlackHoleQueueClient.js +29 -29
- package/lib/cjs/BlackHoleQueueClient.js.map +1 -1
- package/lib/cjs/config/queue.d.ts +10 -10
- package/lib/cjs/config/queue.js +17 -17
- package/lib/cjs/decorators.d.ts +19 -19
- package/lib/cjs/decorators.js +35 -35
- package/lib/cjs/index.d.ts +38 -38
- package/lib/cjs/index.js +167 -167
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces.d.ts +213 -213
- package/lib/cjs/interfaces.js +168 -168
- package/lib/cjs/interfaces.js.map +1 -1
- package/lib/cjs/migrations/Queue_2022_10_18_01_13_00.d.ts +5 -5
- package/lib/cjs/migrations/Queue_2022_10_18_01_13_00.js +35 -35
- package/lib/cjs/migrations/Queue_2022_10_18_01_13_00.js.map +1 -1
- package/lib/cjs/models/JobModel.d.ts +19 -19
- package/lib/cjs/models/JobModel.js +46 -46
- package/lib/cjs/models/JobModel.js.map +1 -1
- package/lib/mjs/BlackHoleQueueClient.d.ts +11 -11
- package/lib/mjs/BlackHoleQueueClient.js +26 -26
- package/lib/mjs/BlackHoleQueueClient.js.map +1 -1
- package/lib/mjs/config/queue.d.ts +10 -10
- package/lib/mjs/config/queue.js +15 -15
- package/lib/mjs/decorators.d.ts +19 -19
- package/lib/mjs/decorators.js +30 -30
- package/lib/mjs/index.d.ts +38 -38
- package/lib/mjs/index.js +150 -150
- package/lib/mjs/index.js.map +1 -1
- package/lib/mjs/interfaces.d.ts +213 -213
- package/lib/mjs/interfaces.js +156 -156
- package/lib/mjs/interfaces.js.map +1 -1
- package/lib/mjs/migrations/Queue_2022_10_18_01_13_00.d.ts +5 -5
- package/lib/mjs/migrations/Queue_2022_10_18_01_13_00.js +32 -32
- package/lib/mjs/migrations/Queue_2022_10_18_01_13_00.js.map +1 -1
- package/lib/mjs/models/JobModel.d.ts +19 -19
- package/lib/mjs/models/JobModel.js +43 -43
- package/lib/mjs/models/JobModel.js.map +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.mjs.tsbuildinfo +1 -1
- package/package.json +6 -6
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Injectable, NewInstance } from '@spinajs/di';
|
|
8
|
-
import { QueueClient } from './interfaces.js';
|
|
9
|
-
/**
|
|
10
|
-
* Empty queue, does nothing.
|
|
11
|
-
* Use it, if you want to route or dismiss messages sent by queue service
|
|
12
|
-
*/
|
|
13
|
-
let BlackHoleQueueClient = class BlackHoleQueueClient extends QueueClient {
|
|
14
|
-
emit(_event) {
|
|
15
|
-
return Promise.resolve();
|
|
16
|
-
}
|
|
17
|
-
subscribe(_channel, _callback, _subscriptionId, _durable) {
|
|
18
|
-
return Promise.resolve();
|
|
19
|
-
}
|
|
20
|
-
unsubscribe(_channel) { }
|
|
21
|
-
};
|
|
22
|
-
BlackHoleQueueClient = __decorate([
|
|
23
|
-
NewInstance(),
|
|
24
|
-
Injectable(QueueClient)
|
|
25
|
-
], BlackHoleQueueClient);
|
|
26
|
-
export { BlackHoleQueueClient };
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Injectable, NewInstance } from '@spinajs/di';
|
|
8
|
+
import { QueueClient } from './interfaces.js';
|
|
9
|
+
/**
|
|
10
|
+
* Empty queue, does nothing.
|
|
11
|
+
* Use it, if you want to route or dismiss messages sent by queue service
|
|
12
|
+
*/
|
|
13
|
+
let BlackHoleQueueClient = class BlackHoleQueueClient extends QueueClient {
|
|
14
|
+
emit(_event) {
|
|
15
|
+
return Promise.resolve();
|
|
16
|
+
}
|
|
17
|
+
subscribe(_channel, _callback, _subscriptionId, _durable) {
|
|
18
|
+
return Promise.resolve();
|
|
19
|
+
}
|
|
20
|
+
unsubscribe(_channel) { }
|
|
21
|
+
};
|
|
22
|
+
BlackHoleQueueClient = __decorate([
|
|
23
|
+
NewInstance(),
|
|
24
|
+
Injectable(QueueClient)
|
|
25
|
+
], BlackHoleQueueClient);
|
|
26
|
+
export { BlackHoleQueueClient };
|
|
27
27
|
//# sourceMappingURL=BlackHoleQueueClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlackHoleQueueClient.js","sourceRoot":"","sources":["../../src/BlackHoleQueueClient.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAe,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAiB,WAAW,EAAgB,MAAM,iBAAiB,CAAC;AAE3E;;;GAGG;AAGI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,WAAW;IAC5C,IAAI,CAAC,MAAqB;QAC/B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IACM,SAAS,CAAC,QAA4C,EAAE,SAA8C,EAAE,eAAwB,EAAE,QAAkB;QACzJ,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IACM,WAAW,CAAC,QAA4C,IAAS,CAAC;CAC1E,CAAA;AARY,oBAAoB;IAFhC,WAAW,EAAE;IACb,UAAU,CAAC,WAAW,CAAC;GACX,oBAAoB,CAQhC
|
|
1
|
+
{"version":3,"file":"BlackHoleQueueClient.js","sourceRoot":"","sources":["../../src/BlackHoleQueueClient.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAe,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAiB,WAAW,EAAgB,MAAM,iBAAiB,CAAC;AAE3E;;;GAGG;AAGI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,WAAW;IAC5C,IAAI,CAAC,MAAqB;QAC/B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IACM,SAAS,CAAC,QAA4C,EAAE,SAA8C,EAAE,eAAwB,EAAE,QAAkB;QACzJ,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IACM,WAAW,CAAC,QAA4C,IAAS,CAAC;CAC1E,CAAA;AARY,oBAAoB;IAFhC,WAAW,EAAE;IACb,UAAU,CAAC,WAAW,CAAC;GACX,oBAAoB,CAQhC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
declare const queue: {
|
|
2
|
-
queue: {
|
|
3
|
-
default: string;
|
|
4
|
-
connections: {
|
|
5
|
-
name: string;
|
|
6
|
-
service: string;
|
|
7
|
-
}[];
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export default queue;
|
|
1
|
+
declare const queue: {
|
|
2
|
+
queue: {
|
|
3
|
+
default: string;
|
|
4
|
+
connections: {
|
|
5
|
+
name: string;
|
|
6
|
+
service: string;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export default queue;
|
|
11
11
|
//# sourceMappingURL=queue.d.ts.map
|
package/lib/mjs/config/queue.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const queue = {
|
|
2
|
-
queue: {
|
|
3
|
-
// by default, all messages are sent to black hole
|
|
4
|
-
// becouse some modules use queues to pass events eg. user login
|
|
5
|
-
// but not always in project we want to use queue or have queue server
|
|
6
|
-
default: 'black-hole',
|
|
7
|
-
connections: [
|
|
8
|
-
{
|
|
9
|
-
name: 'black-hole',
|
|
10
|
-
service: 'BlackHoleQueueClient',
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
export default queue;
|
|
1
|
+
const queue = {
|
|
2
|
+
queue: {
|
|
3
|
+
// by default, all messages are sent to black hole
|
|
4
|
+
// becouse some modules use queues to pass events eg. user login
|
|
5
|
+
// but not always in project we want to use queue or have queue server
|
|
6
|
+
default: 'black-hole',
|
|
7
|
+
connections: [
|
|
8
|
+
{
|
|
9
|
+
name: 'black-hole',
|
|
10
|
+
service: 'BlackHoleQueueClient',
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
export default queue;
|
|
16
16
|
//# sourceMappingURL=queue.js.map
|
package/lib/mjs/decorators.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export interface IEventOption {
|
|
2
|
-
/**
|
|
3
|
-
* Should event survive consumer restart ?
|
|
4
|
-
*/
|
|
5
|
-
durable?: boolean;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* Mark class as job
|
|
10
|
-
*
|
|
11
|
-
* @param connection - job connection name for use, if not set default connection is used
|
|
12
|
-
*/
|
|
13
|
-
export declare function Job(): (target: any) => void;
|
|
14
|
-
/**
|
|
15
|
-
* Mark class as event
|
|
16
|
-
*
|
|
17
|
-
* @param connection - event connection name for use, if not set default connection is used
|
|
18
|
-
*/
|
|
19
|
-
export declare function Event(options?: IEventOption): (target: any) => void;
|
|
1
|
+
export interface IEventOption {
|
|
2
|
+
/**
|
|
3
|
+
* Should event survive consumer restart ?
|
|
4
|
+
*/
|
|
5
|
+
durable?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* Mark class as job
|
|
10
|
+
*
|
|
11
|
+
* @param connection - job connection name for use, if not set default connection is used
|
|
12
|
+
*/
|
|
13
|
+
export declare function Job(): (target: any) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Mark class as event
|
|
16
|
+
*
|
|
17
|
+
* @param connection - event connection name for use, if not set default connection is used
|
|
18
|
+
*/
|
|
19
|
+
export declare function Event(options?: IEventOption): (target: any) => void;
|
|
20
20
|
//# sourceMappingURL=decorators.d.ts.map
|
package/lib/mjs/decorators.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Mark class as job
|
|
4
|
-
*
|
|
5
|
-
* @param connection - job connection name for use, if not set default connection is used
|
|
6
|
-
*/
|
|
7
|
-
export function Job() {
|
|
8
|
-
return (target) => {
|
|
9
|
-
if (!Reflect.hasMetadata('queue:options', target)) {
|
|
10
|
-
Reflect.defineMetadata('queue:options', {
|
|
11
|
-
type: 'job',
|
|
12
|
-
}, target);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Mark class as event
|
|
18
|
-
*
|
|
19
|
-
* @param connection - event connection name for use, if not set default connection is used
|
|
20
|
-
*/
|
|
21
|
-
export function Event(options) {
|
|
22
|
-
return (target) => {
|
|
23
|
-
if (!Reflect.hasMetadata('queue:options', target)) {
|
|
24
|
-
Reflect.defineMetadata('queue:options', {
|
|
25
|
-
...options,
|
|
26
|
-
type: 'event',
|
|
27
|
-
}, target);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Mark class as job
|
|
4
|
+
*
|
|
5
|
+
* @param connection - job connection name for use, if not set default connection is used
|
|
6
|
+
*/
|
|
7
|
+
export function Job() {
|
|
8
|
+
return (target) => {
|
|
9
|
+
if (!Reflect.hasMetadata('queue:options', target)) {
|
|
10
|
+
Reflect.defineMetadata('queue:options', {
|
|
11
|
+
type: 'job',
|
|
12
|
+
}, target);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Mark class as event
|
|
18
|
+
*
|
|
19
|
+
* @param connection - event connection name for use, if not set default connection is used
|
|
20
|
+
*/
|
|
21
|
+
export function Event(options) {
|
|
22
|
+
return (target) => {
|
|
23
|
+
if (!Reflect.hasMetadata('queue:options', target)) {
|
|
24
|
+
Reflect.defineMetadata('queue:options', {
|
|
25
|
+
...options,
|
|
26
|
+
type: 'event',
|
|
27
|
+
}, target);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
31
|
//# sourceMappingURL=decorators.js.map
|
package/lib/mjs/index.d.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { Constructor } from '@spinajs/di';
|
|
2
|
-
import { Log } from '@spinajs/log';
|
|
3
|
-
import { QueueClient, QueueJob, QueueEvent, IQueueMessage, QueueMessage, QueueService } from './interfaces.js';
|
|
4
|
-
export * from './BlackHoleQueueClient.js';
|
|
5
|
-
export * from './interfaces.js';
|
|
6
|
-
export * from './decorators.js';
|
|
7
|
-
export * from './models/JobModel.js';
|
|
8
|
-
export * from './migrations/Queue_2022_10_18_01_13_00.js';
|
|
9
|
-
export declare class DefaultQueueService extends QueueService {
|
|
10
|
-
protected Log: Log;
|
|
11
|
-
protected Connections: Map<string, QueueClient>;
|
|
12
|
-
dispose(): Promise<void>;
|
|
13
|
-
emit(event: IQueueMessage | QueueEvent | QueueJob): Promise<void>;
|
|
14
|
-
stopConsuming(event: Constructor<QueueMessage>): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* Starts to consume events/jobs from connection
|
|
18
|
-
*
|
|
19
|
-
* NOTE: When consuming events, we can have multiple event types on same channel, couse
|
|
20
|
-
* subscribe function filters it out, and event can be handled in another subscription
|
|
21
|
-
*
|
|
22
|
-
* When consuming jobs, multiple jobs on same channel can have unpredictible behavior becouse
|
|
23
|
-
* job can be executed once even with multiple subscribers, so filtering it out
|
|
24
|
-
* prevents from executing it on other subscriptions
|
|
25
|
-
*
|
|
26
|
-
* @param event - event type to consume
|
|
27
|
-
* @param callback - optional callback when job is consumet, mandatory for events
|
|
28
|
-
* @param subscriptionId - optional subscription id if consuming durable events
|
|
29
|
-
* @param durable - is durable event, if not set, this value default to event decorator options
|
|
30
|
-
*/
|
|
31
|
-
consume<T extends QueueMessage>(event: Constructor<QueueMessage>, callback?: (message: T) => Promise<void>, subscriptionId?: string, durable?: boolean): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Get specific queue client connection. If no connection param is provided, default is returned.
|
|
34
|
-
* @param connection - connection name to obtain
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
get(connection?: string): QueueClient;
|
|
38
|
-
}
|
|
1
|
+
import { Constructor } from '@spinajs/di';
|
|
2
|
+
import { Log } from '@spinajs/log';
|
|
3
|
+
import { QueueClient, QueueJob, QueueEvent, IQueueMessage, QueueMessage, QueueService } from './interfaces.js';
|
|
4
|
+
export * from './BlackHoleQueueClient.js';
|
|
5
|
+
export * from './interfaces.js';
|
|
6
|
+
export * from './decorators.js';
|
|
7
|
+
export * from './models/JobModel.js';
|
|
8
|
+
export * from './migrations/Queue_2022_10_18_01_13_00.js';
|
|
9
|
+
export declare class DefaultQueueService extends QueueService {
|
|
10
|
+
protected Log: Log;
|
|
11
|
+
protected Connections: Map<string, QueueClient>;
|
|
12
|
+
dispose(): Promise<void>;
|
|
13
|
+
emit(event: IQueueMessage | QueueEvent | QueueJob): Promise<void>;
|
|
14
|
+
stopConsuming(event: Constructor<QueueMessage>): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* Starts to consume events/jobs from connection
|
|
18
|
+
*
|
|
19
|
+
* NOTE: When consuming events, we can have multiple event types on same channel, couse
|
|
20
|
+
* subscribe function filters it out, and event can be handled in another subscription
|
|
21
|
+
*
|
|
22
|
+
* When consuming jobs, multiple jobs on same channel can have unpredictible behavior becouse
|
|
23
|
+
* job can be executed once even with multiple subscribers, so filtering it out
|
|
24
|
+
* prevents from executing it on other subscriptions
|
|
25
|
+
*
|
|
26
|
+
* @param event - event type to consume
|
|
27
|
+
* @param callback - optional callback when job is consumet, mandatory for events
|
|
28
|
+
* @param subscriptionId - optional subscription id if consuming durable events
|
|
29
|
+
* @param durable - is durable event, if not set, this value default to event decorator options
|
|
30
|
+
*/
|
|
31
|
+
consume<T extends QueueMessage>(event: Constructor<QueueMessage>, callback?: (message: T) => Promise<void>, subscriptionId?: string, durable?: boolean): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Get specific queue client connection. If no connection param is provided, default is returned.
|
|
34
|
+
* @param connection - connection name to obtain
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
get(connection?: string): QueueClient;
|
|
38
|
+
}
|
|
39
39
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/mjs/index.js
CHANGED
|
@@ -1,151 +1,151 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { UnexpectedServerError, InvalidArgument } from '@spinajs/exceptions';
|
|
11
|
-
import { DI, Injectable, ServiceNotFound } from '@spinajs/di';
|
|
12
|
-
import { Log, Logger } from '@spinajs/log';
|
|
13
|
-
import { QueueClient, QueueJob, QueueEvent, QueueService, isJob } from './interfaces.js';
|
|
14
|
-
import { JobModel } from './models/JobModel.js';
|
|
15
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
16
|
-
import { AutoinjectService } from '@spinajs/configuration';
|
|
17
|
-
import { DateTime } from 'luxon';
|
|
18
|
-
export * from './BlackHoleQueueClient.js';
|
|
19
|
-
export * from './interfaces.js';
|
|
20
|
-
export * from './decorators.js';
|
|
21
|
-
export * from './models/JobModel.js';
|
|
22
|
-
export * from './migrations/Queue_2022_10_18_01_13_00.js';
|
|
23
|
-
let DefaultQueueService = class DefaultQueueService extends QueueService {
|
|
24
|
-
async dispose() {
|
|
25
|
-
this.Connections.forEach(async (val) => {
|
|
26
|
-
await val.dispose();
|
|
27
|
-
});
|
|
28
|
-
this.Connections.clear();
|
|
29
|
-
}
|
|
30
|
-
async emit(event) {
|
|
31
|
-
const connections = this.getConnectionsForMessage(event);
|
|
32
|
-
for (let c of connections) {
|
|
33
|
-
if (isJob(event)) {
|
|
34
|
-
const jModel = new JobModel();
|
|
35
|
-
jModel.JobId = uuidv4();
|
|
36
|
-
jModel.Name = event.Name;
|
|
37
|
-
jModel.Status = 'created';
|
|
38
|
-
jModel.Progress = 0;
|
|
39
|
-
jModel.Connection = c;
|
|
40
|
-
await jModel.insert();
|
|
41
|
-
event.JobId = jModel.JobId;
|
|
42
|
-
}
|
|
43
|
-
this.Connections.get(c).emit(event);
|
|
44
|
-
this.Log.trace(`Emitted message ${event.Name}, type: ${event.Type} to connection ${c}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
async stopConsuming(event) {
|
|
48
|
-
this.getConnectionsForMessage(event).forEach((c) => this.Connections.get(c).unsubscribe(event));
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
* Starts to consume events/jobs from connection
|
|
53
|
-
*
|
|
54
|
-
* NOTE: When consuming events, we can have multiple event types on same channel, couse
|
|
55
|
-
* subscribe function filters it out, and event can be handled in another subscription
|
|
56
|
-
*
|
|
57
|
-
* When consuming jobs, multiple jobs on same channel can have unpredictible behavior becouse
|
|
58
|
-
* job can be executed once even with multiple subscribers, so filtering it out
|
|
59
|
-
* prevents from executing it on other subscriptions
|
|
60
|
-
*
|
|
61
|
-
* @param event - event type to consume
|
|
62
|
-
* @param callback - optional callback when job is consumet, mandatory for events
|
|
63
|
-
* @param subscriptionId - optional subscription id if consuming durable events
|
|
64
|
-
* @param durable - is durable event, if not set, this value default to event decorator options
|
|
65
|
-
*/
|
|
66
|
-
async consume(event, callback, subscriptionId, durable) {
|
|
67
|
-
const options = Reflect.getMetadata('queue:options', event);
|
|
68
|
-
const self = this;
|
|
69
|
-
if (!options) {
|
|
70
|
-
throw new InvalidArgument(`Type ${event.name} is not defined as Job or Event type. Use proper decorator to configure queue events`);
|
|
71
|
-
}
|
|
72
|
-
const { durable: eDurable } = options;
|
|
73
|
-
const connections = this.getConnectionsForMessage(event);
|
|
74
|
-
if ((eDurable || durable) && !subscriptionId) {
|
|
75
|
-
throw new InvalidArgument('subscriptionId should be set when using durable events');
|
|
76
|
-
}
|
|
77
|
-
for (let c of connections) {
|
|
78
|
-
const conn = this.Connections.get(c);
|
|
79
|
-
if (!conn) {
|
|
80
|
-
throw new ServiceNotFound(`Queue connection ${c} not found. Please check your configuration before consuming events from this connection.`);
|
|
81
|
-
}
|
|
82
|
-
await conn.subscribe(event, async (e) => {
|
|
83
|
-
if (e.Name === event.name) {
|
|
84
|
-
const ev = DI.resolve(event);
|
|
85
|
-
ev.hydrate(e);
|
|
86
|
-
/**
|
|
87
|
-
* Handle job type of message
|
|
88
|
-
* To preserve result & handle delay, errors etc..
|
|
89
|
-
*/
|
|
90
|
-
if (ev instanceof QueueJob) {
|
|
91
|
-
let jobResult = null;
|
|
92
|
-
const jModel = await JobModel.where({ JobId: ev.JobId }).firstOrThrow(new UnexpectedServerError(`No model found for jobId ${ev.JobId}`));
|
|
93
|
-
jModel.Status = 'executing';
|
|
94
|
-
jModel.ExecutedAt = DateTime.now();
|
|
95
|
-
try {
|
|
96
|
-
// update executing state
|
|
97
|
-
await jModel.update();
|
|
98
|
-
jobResult = await ev.execute(onProgress);
|
|
99
|
-
jModel.Result = jobResult;
|
|
100
|
-
jModel.Status = 'success';
|
|
101
|
-
jModel.FinishedAt = DateTime.now();
|
|
102
|
-
jModel.Progress = 100;
|
|
103
|
-
this.Log.trace(`Job ${event.name} processed with result ${JSON.stringify(jModel.Result)}`);
|
|
104
|
-
}
|
|
105
|
-
catch (err) {
|
|
106
|
-
this.Log.error(err, `Cannot execute job ${event.name}`);
|
|
107
|
-
jModel.Result = {
|
|
108
|
-
message: err.message,
|
|
109
|
-
};
|
|
110
|
-
jModel.Status = 'error';
|
|
111
|
-
}
|
|
112
|
-
await jModel.update();
|
|
113
|
-
async function onProgress(p) {
|
|
114
|
-
jModel.Progress = p;
|
|
115
|
-
await jModel.update();
|
|
116
|
-
self.Log.trace(`Job ${event.name}:${jModel.JobId} progress: ${p}%`);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
if (!callback && ev instanceof QueueEvent) {
|
|
120
|
-
throw new InvalidArgument('when subscribing to events, callback cannot be null. Subscriber should handle event in callback function !');
|
|
121
|
-
}
|
|
122
|
-
this.Log.trace(`Queue message ${event.name} processed`);
|
|
123
|
-
if (callback) {
|
|
124
|
-
return callback(ev);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}, subscriptionId, durable ?? eDurable ?? false);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Get specific queue client connection. If no connection param is provided, default is returned.
|
|
132
|
-
* @param connection - connection name to obtain
|
|
133
|
-
* @returns
|
|
134
|
-
*/
|
|
135
|
-
get(connection) {
|
|
136
|
-
return this.Connections.get(`${connection ?? this.Configuration.default}`);
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
__decorate([
|
|
140
|
-
Logger('queue'),
|
|
141
|
-
__metadata("design:type", Log)
|
|
142
|
-
], DefaultQueueService.prototype, "Log", void 0);
|
|
143
|
-
__decorate([
|
|
144
|
-
AutoinjectService('queue.connections', QueueClient),
|
|
145
|
-
__metadata("design:type", Map)
|
|
146
|
-
], DefaultQueueService.prototype, "Connections", void 0);
|
|
147
|
-
DefaultQueueService = __decorate([
|
|
148
|
-
Injectable(QueueService)
|
|
149
|
-
], DefaultQueueService);
|
|
150
|
-
export { DefaultQueueService };
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { UnexpectedServerError, InvalidArgument } from '@spinajs/exceptions';
|
|
11
|
+
import { DI, Injectable, ServiceNotFound } from '@spinajs/di';
|
|
12
|
+
import { Log, Logger } from '@spinajs/log';
|
|
13
|
+
import { QueueClient, QueueJob, QueueEvent, QueueService, isJob } from './interfaces.js';
|
|
14
|
+
import { JobModel } from './models/JobModel.js';
|
|
15
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
16
|
+
import { AutoinjectService } from '@spinajs/configuration';
|
|
17
|
+
import { DateTime } from 'luxon';
|
|
18
|
+
export * from './BlackHoleQueueClient.js';
|
|
19
|
+
export * from './interfaces.js';
|
|
20
|
+
export * from './decorators.js';
|
|
21
|
+
export * from './models/JobModel.js';
|
|
22
|
+
export * from './migrations/Queue_2022_10_18_01_13_00.js';
|
|
23
|
+
let DefaultQueueService = class DefaultQueueService extends QueueService {
|
|
24
|
+
async dispose() {
|
|
25
|
+
this.Connections.forEach(async (val) => {
|
|
26
|
+
await val.dispose();
|
|
27
|
+
});
|
|
28
|
+
this.Connections.clear();
|
|
29
|
+
}
|
|
30
|
+
async emit(event) {
|
|
31
|
+
const connections = this.getConnectionsForMessage(event);
|
|
32
|
+
for (let c of connections) {
|
|
33
|
+
if (isJob(event)) {
|
|
34
|
+
const jModel = new JobModel();
|
|
35
|
+
jModel.JobId = uuidv4();
|
|
36
|
+
jModel.Name = event.Name;
|
|
37
|
+
jModel.Status = 'created';
|
|
38
|
+
jModel.Progress = 0;
|
|
39
|
+
jModel.Connection = c;
|
|
40
|
+
await jModel.insert();
|
|
41
|
+
event.JobId = jModel.JobId;
|
|
42
|
+
}
|
|
43
|
+
this.Connections.get(c).emit(event);
|
|
44
|
+
this.Log.trace(`Emitted message ${event.Name}, type: ${event.Type} to connection ${c}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async stopConsuming(event) {
|
|
48
|
+
this.getConnectionsForMessage(event).forEach((c) => this.Connections.get(c).unsubscribe(event));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* Starts to consume events/jobs from connection
|
|
53
|
+
*
|
|
54
|
+
* NOTE: When consuming events, we can have multiple event types on same channel, couse
|
|
55
|
+
* subscribe function filters it out, and event can be handled in another subscription
|
|
56
|
+
*
|
|
57
|
+
* When consuming jobs, multiple jobs on same channel can have unpredictible behavior becouse
|
|
58
|
+
* job can be executed once even with multiple subscribers, so filtering it out
|
|
59
|
+
* prevents from executing it on other subscriptions
|
|
60
|
+
*
|
|
61
|
+
* @param event - event type to consume
|
|
62
|
+
* @param callback - optional callback when job is consumet, mandatory for events
|
|
63
|
+
* @param subscriptionId - optional subscription id if consuming durable events
|
|
64
|
+
* @param durable - is durable event, if not set, this value default to event decorator options
|
|
65
|
+
*/
|
|
66
|
+
async consume(event, callback, subscriptionId, durable) {
|
|
67
|
+
const options = Reflect.getMetadata('queue:options', event);
|
|
68
|
+
const self = this;
|
|
69
|
+
if (!options) {
|
|
70
|
+
throw new InvalidArgument(`Type ${event.name} is not defined as Job or Event type. Use proper decorator to configure queue events`);
|
|
71
|
+
}
|
|
72
|
+
const { durable: eDurable } = options;
|
|
73
|
+
const connections = this.getConnectionsForMessage(event);
|
|
74
|
+
if ((eDurable || durable) && !subscriptionId) {
|
|
75
|
+
throw new InvalidArgument('subscriptionId should be set when using durable events');
|
|
76
|
+
}
|
|
77
|
+
for (let c of connections) {
|
|
78
|
+
const conn = this.Connections.get(c);
|
|
79
|
+
if (!conn) {
|
|
80
|
+
throw new ServiceNotFound(`Queue connection ${c} not found. Please check your configuration before consuming events from this connection.`);
|
|
81
|
+
}
|
|
82
|
+
await conn.subscribe(event, async (e) => {
|
|
83
|
+
if (e.Name === event.name) {
|
|
84
|
+
const ev = DI.resolve(event);
|
|
85
|
+
ev.hydrate(e);
|
|
86
|
+
/**
|
|
87
|
+
* Handle job type of message
|
|
88
|
+
* To preserve result & handle delay, errors etc..
|
|
89
|
+
*/
|
|
90
|
+
if (ev instanceof QueueJob) {
|
|
91
|
+
let jobResult = null;
|
|
92
|
+
const jModel = await JobModel.where({ JobId: ev.JobId }).firstOrThrow(new UnexpectedServerError(`No model found for jobId ${ev.JobId}`));
|
|
93
|
+
jModel.Status = 'executing';
|
|
94
|
+
jModel.ExecutedAt = DateTime.now();
|
|
95
|
+
try {
|
|
96
|
+
// update executing state
|
|
97
|
+
await jModel.update();
|
|
98
|
+
jobResult = await ev.execute(onProgress);
|
|
99
|
+
jModel.Result = jobResult;
|
|
100
|
+
jModel.Status = 'success';
|
|
101
|
+
jModel.FinishedAt = DateTime.now();
|
|
102
|
+
jModel.Progress = 100;
|
|
103
|
+
this.Log.trace(`Job ${event.name} processed with result ${JSON.stringify(jModel.Result)}`);
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
this.Log.error(err, `Cannot execute job ${event.name}`);
|
|
107
|
+
jModel.Result = {
|
|
108
|
+
message: err.message,
|
|
109
|
+
};
|
|
110
|
+
jModel.Status = 'error';
|
|
111
|
+
}
|
|
112
|
+
await jModel.update();
|
|
113
|
+
async function onProgress(p) {
|
|
114
|
+
jModel.Progress = p;
|
|
115
|
+
await jModel.update();
|
|
116
|
+
self.Log.trace(`Job ${event.name}:${jModel.JobId} progress: ${p}%`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (!callback && ev instanceof QueueEvent) {
|
|
120
|
+
throw new InvalidArgument('when subscribing to events, callback cannot be null. Subscriber should handle event in callback function !');
|
|
121
|
+
}
|
|
122
|
+
this.Log.trace(`Queue message ${event.name} processed`);
|
|
123
|
+
if (callback) {
|
|
124
|
+
return callback(ev);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, subscriptionId, durable ?? eDurable ?? false);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get specific queue client connection. If no connection param is provided, default is returned.
|
|
132
|
+
* @param connection - connection name to obtain
|
|
133
|
+
* @returns
|
|
134
|
+
*/
|
|
135
|
+
get(connection) {
|
|
136
|
+
return this.Connections.get(`${connection ?? this.Configuration.default}`);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
__decorate([
|
|
140
|
+
Logger('queue'),
|
|
141
|
+
__metadata("design:type", Log)
|
|
142
|
+
], DefaultQueueService.prototype, "Log", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
AutoinjectService('queue.connections', QueueClient),
|
|
145
|
+
__metadata("design:type", Map)
|
|
146
|
+
], DefaultQueueService.prototype, "Connections", void 0);
|
|
147
|
+
DefaultQueueService = __decorate([
|
|
148
|
+
Injectable(QueueService)
|
|
149
|
+
], DefaultQueueService);
|
|
150
|
+
export { DefaultQueueService };
|
|
151
151
|
//# sourceMappingURL=index.js.map
|
package/lib/mjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAe,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAA+B,YAAY,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACtH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2CAA2C,CAAC;AAGnD,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,YAAY;IAO5C,KAAK,CAAC,OAAO;QAClB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,EA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