@servicelabsco/nestjs-utility-services 1.0.147 → 1.0.148
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/dist/app.controller.d.ts +1 -1
- package/dist/app.controller.js +3 -1
- package/dist/app.controller.js.map +1 -1
- package/dist/common/libraries/common.job.d.ts +1 -0
- package/dist/common/libraries/common.job.js +17 -2
- package/dist/common/libraries/common.job.js.map +1 -1
- package/dist/platformUtility/commands/index.d.ts +1 -0
- package/dist/platformUtility/commands/index.js +1 -0
- package/dist/platformUtility/commands/index.js.map +1 -1
- package/dist/platformUtility/commands/sqs.worker.command.d.ts +15 -0
- package/dist/platformUtility/commands/sqs.worker.command.js +111 -0
- package/dist/platformUtility/commands/sqs.worker.command.js.map +1 -0
- package/dist/platformUtility/es6.classes.d.ts +6 -3
- package/dist/platformUtility/es6.classes.js +6 -2
- package/dist/platformUtility/es6.classes.js.map +1 -1
- package/dist/platformUtility/jobs/index.d.ts +1 -0
- package/dist/platformUtility/jobs/index.js +1 -0
- package/dist/platformUtility/jobs/index.js.map +1 -1
- package/dist/platformUtility/jobs/test.job.d.ts +8 -0
- package/dist/platformUtility/jobs/test.job.js +42 -0
- package/dist/platformUtility/jobs/test.job.js.map +1 -0
- package/dist/platformUtility/services/dynamo.service.js +4 -4
- package/dist/platformUtility/services/dynamo.service.js.map +1 -1
- package/dist/platformUtility/services/es6.jobs.service.d.ts +3 -1
- package/dist/platformUtility/services/es6.jobs.service.js +7 -2
- package/dist/platformUtility/services/es6.jobs.service.js.map +1 -1
- package/dist/platformUtility/services/index.d.ts +1 -0
- package/dist/platformUtility/services/index.js +1 -0
- package/dist/platformUtility/services/index.js.map +1 -1
- package/dist/platformUtility/services/queue.service.d.ts +7 -4
- package/dist/platformUtility/services/queue.service.js +23 -10
- package/dist/platformUtility/services/queue.service.js.map +1 -1
- package/dist/platformUtility/services/sqs.service.d.ts +8 -0
- package/dist/platformUtility/services/sqs.service.js +86 -0
- package/dist/platformUtility/services/sqs.service.js.map +1 -0
- package/package.json +1 -1
package/dist/app.controller.d.ts
CHANGED
package/dist/app.controller.js
CHANGED
@@ -39,7 +39,9 @@ let AppController = class AppController {
|
|
39
39
|
});
|
40
40
|
}
|
41
41
|
set() {
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
43
|
+
return this.queueService.addJob('b20ed62e97fbef22a56c84c4908996a6', 123);
|
44
|
+
});
|
43
45
|
}
|
44
46
|
};
|
45
47
|
__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAAiD;AACjD,+CAA2C;AAC3C,kDAA+C;AAE/C,4EAAwE;AAGxE,IAAa,aAAa,GAA1B,MAAa,aAAa;IACtB,YAA6B,UAAsB,EAAmB,YAA0B;QAAnE,eAAU,GAAV,UAAU,CAAY;QAAmB,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAG9F,GAAG;;YACL,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;QACvC,CAAC;KAAA;IAQK,iBAAiB;;YACnB,OAAO,WAAI,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;KAAA;IAGK,GAAG;
|
1
|
+
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAAiD;AACjD,+CAA2C;AAC3C,kDAA+C;AAE/C,4EAAwE;AAGxE,IAAa,aAAa,GAA1B,MAAa,aAAa;IACtB,YAA6B,UAAsB,EAAmB,YAA0B;QAAnE,eAAU,GAAV,UAAU,CAAY;QAAmB,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAG9F,GAAG;;YACL,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;QACvC,CAAC;KAAA;IAQK,iBAAiB;;YACnB,OAAO,WAAI,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;KAAA;IAGK,GAAG;;YACL,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;QAE7E,CAAC;KAAA;CACJ,CAAA;AAnBG;IADC,IAAA,YAAG,GAAE;;;;wCAGL;AAQD;IADC,IAAA,YAAG,EAAC,UAAU,CAAC;;;;sDAGf;AAGD;IADC,IAAA,YAAG,EAAC,KAAK,CAAC;;;;wCAIV;AAtBQ,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAEgC,wBAAU,EAAiC,4BAAY;GADvF,aAAa,CAuBzB;AAvBY,sCAAa"}
|
@@ -3,6 +3,7 @@ import { QueueOptionsDto } from '../../platformUtility/dtos/queue.options.dto';
|
|
3
3
|
import { QueueService } from '../../platformUtility/services/queue.service';
|
4
4
|
import { BaseJobInterface } from './base.job.interface';
|
5
5
|
export declare class CommonJob implements BaseJobInterface {
|
6
|
+
protected mode: string;
|
6
7
|
protected queueService: QueueService;
|
7
8
|
dispatch(data: any, options?: QueueOptionsDto): Promise<any>;
|
8
9
|
delayedDispatch(data: any, options?: QueueOptionsDto): Promise<any>;
|
@@ -10,8 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.CommonJob = void 0;
|
13
|
+
const operation_exception_1 = require("./../exceptions/operation.exception");
|
14
|
+
const config = require("config");
|
13
15
|
const hash_1 = require("./hash");
|
14
16
|
class CommonJob {
|
17
|
+
constructor() {
|
18
|
+
this.mode = 'redis';
|
19
|
+
}
|
15
20
|
dispatch(data, options) {
|
16
21
|
return __awaiter(this, void 0, void 0, function* () {
|
17
22
|
const payload = {
|
@@ -20,7 +25,12 @@ class CommonJob {
|
|
20
25
|
name: this.constructor.name,
|
21
26
|
};
|
22
27
|
options = options !== null && options !== void 0 ? options : {};
|
23
|
-
|
28
|
+
if (this.mode === 'redis')
|
29
|
+
return this.queueService.add('generic.job.trigger', payload, options);
|
30
|
+
const sqsQueue = config.get(`sqs.${this.mode}`);
|
31
|
+
if (!sqsQueue)
|
32
|
+
throw new operation_exception_1.OperationException(`Queue ${this.mode} is not defined in the system. please add is under sqs`);
|
33
|
+
return this.queueService.sqsService.add(sqsQueue, payload);
|
24
34
|
});
|
25
35
|
}
|
26
36
|
delayedDispatch(data, options) {
|
@@ -32,7 +42,12 @@ class CommonJob {
|
|
32
42
|
};
|
33
43
|
options = options !== null && options !== void 0 ? options : {};
|
34
44
|
options.delay = options.delay || 200;
|
35
|
-
|
45
|
+
if (this.mode === 'redis')
|
46
|
+
return this.queueService.add('generic.job.trigger', payload, options);
|
47
|
+
const sqsQueue = config.get(`sqs.${this.mode}`);
|
48
|
+
if (!sqsQueue)
|
49
|
+
throw new operation_exception_1.OperationException(`Queue ${this.mode} is not defined in the system. please add is under sqs`);
|
50
|
+
return this.queueService.sqsService.add(sqsQueue, payload);
|
36
51
|
});
|
37
52
|
}
|
38
53
|
handle(data, job) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.job.js","sourceRoot":"","sources":["../../../src/common/libraries/common.job.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"common.job.js","sourceRoot":"","sources":["../../../src/common/libraries/common.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6EAAyE;AAEzE,iCAAiC;AAIjC,iCAA8B;AAO9B,MAAa,SAAS;IAAtB;QAQc,SAAI,GAAW,OAAO,CAAC;IAoErC,CAAC;IApDS,QAAQ,CAAC,IAAS,EAAE,OAAyB;;YAC/C,MAAM,OAAO,GAAG;gBACZ,GAAG,EAAE,WAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;gBACxC,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,I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AAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/D,CAAC;KAAA;IASK,MAAM,CAAC,IAAS,EAAE,GAAS;;YAC7B,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;CACJ;AA5ED,8BA4EC"}
|
@@ -13,4 +13,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./entity.generator.command"), exports);
|
14
14
|
__exportStar(require("./maintenance.command"), exports);
|
15
15
|
__exportStar(require("./sync.class.command"), exports);
|
16
|
+
__exportStar(require("./sqs.worker.command"), exports);
|
16
17
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAA2C;AAC3C,wDAAsC;AACtC,uDAAqC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAA2C;AAC3C,wDAAsC;AACtC,uDAAqC;AACrC,uDAAqC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { ConsoleService } from 'nestjs-console';
|
2
|
+
import { QueueService } from '../../platformUtility/services/queue.service';
|
3
|
+
export declare class SqsWorkerCommand {
|
4
|
+
private readonly queueService;
|
5
|
+
private readonly consoleService;
|
6
|
+
private counter;
|
7
|
+
private start_time;
|
8
|
+
constructor(queueService: QueueService, consoleService: ConsoleService);
|
9
|
+
runWorker: () => Promise<never>;
|
10
|
+
private processMessage;
|
11
|
+
private dropMessage;
|
12
|
+
private fetchMessages;
|
13
|
+
private processMessages;
|
14
|
+
private checkForSystem;
|
15
|
+
}
|
@@ -0,0 +1,111 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
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;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
18
|
+
});
|
19
|
+
};
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
21
|
+
exports.SqsWorkerCommand = void 0;
|
22
|
+
const common_1 = require("@nestjs/common");
|
23
|
+
const config = require("config");
|
24
|
+
const nestjs_console_1 = require("nestjs-console");
|
25
|
+
const platform_constants_1 = require("../../config/platform.constants");
|
26
|
+
const queue_service_1 = require("../../platformUtility/services/queue.service");
|
27
|
+
const date_util_1 = require("./../../common/libraries/date.util");
|
28
|
+
const sqsQueue = config.get('sqs.fifo');
|
29
|
+
let SqsWorkerCommand = class SqsWorkerCommand {
|
30
|
+
constructor(queueService, consoleService) {
|
31
|
+
this.queueService = queueService;
|
32
|
+
this.consoleService = consoleService;
|
33
|
+
this.counter = 0;
|
34
|
+
this.start_time = date_util_1.DateUtil.getDateTimeInFormat();
|
35
|
+
this.runWorker = () => __awaiter(this, void 0, void 0, function* () {
|
36
|
+
while (true) {
|
37
|
+
yield this.queueService.pause();
|
38
|
+
yield this.checkForSystem();
|
39
|
+
let record;
|
40
|
+
try {
|
41
|
+
record = yield this.fetchMessages();
|
42
|
+
}
|
43
|
+
catch (error) {
|
44
|
+
global.console.log('error', error);
|
45
|
+
}
|
46
|
+
if (!(record === null || record === void 0 ? void 0 : record.Messages))
|
47
|
+
yield this.queueService.sleep(1000);
|
48
|
+
if ((record === null || record === void 0 ? void 0 : record.Messages) && Array.isArray(record.Messages)) {
|
49
|
+
yield this.processMessages(record.Messages);
|
50
|
+
}
|
51
|
+
global.console.log(`[sqs.fifo][events] ${this.start_time} : ${this.counter}`);
|
52
|
+
}
|
53
|
+
});
|
54
|
+
const cli = this.consoleService.getCli();
|
55
|
+
this.consoleService.createCommand({
|
56
|
+
command: 'queue:sqs',
|
57
|
+
description: 'sync all entities and their definitions defined within the system',
|
58
|
+
}, this.runWorker, cli);
|
59
|
+
}
|
60
|
+
processMessage(message) {
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
62
|
+
++this.counter;
|
63
|
+
const data = JSON.parse(message.Body);
|
64
|
+
global.console.log(`[sqs.fifo][ Processing] ${message.MessageId} : ${data.name} `);
|
65
|
+
const startTime = date_util_1.DateUtil.now();
|
66
|
+
try {
|
67
|
+
yield platform_constants_1.default.jobs[data.job].handle(data.payload);
|
68
|
+
const timeTaken = date_util_1.DateUtil.now() - startTime;
|
69
|
+
global.console.log(`[sqs.fifo][ Processed] ${message.MessageId} : ${data.name} ${timeTaken} ms`);
|
70
|
+
}
|
71
|
+
catch (error) {
|
72
|
+
global.console.log(`[sqs.fifo][ failure] ${message.MessageId} : ${data.name} `);
|
73
|
+
global.console.log('failed-job', data);
|
74
|
+
global.console.log('error', error);
|
75
|
+
}
|
76
|
+
finally {
|
77
|
+
this.dropMessage(message.ReceiptHandle);
|
78
|
+
}
|
79
|
+
});
|
80
|
+
}
|
81
|
+
dropMessage(id) {
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
83
|
+
return this.queueService.sqsService.delete(sqsQueue, id);
|
84
|
+
});
|
85
|
+
}
|
86
|
+
fetchMessages() {
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
88
|
+
return this.queueService.sqsService.get(sqsQueue, 10);
|
89
|
+
});
|
90
|
+
}
|
91
|
+
processMessages(messages) {
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
93
|
+
for (const message of messages)
|
94
|
+
yield this.processMessage(message);
|
95
|
+
});
|
96
|
+
}
|
97
|
+
checkForSystem() {
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
99
|
+
yield this.queueService.checkForMaintenance();
|
100
|
+
if (yield this.queueService.hasRestartFlagChanged()) {
|
101
|
+
process.exit(0);
|
102
|
+
}
|
103
|
+
});
|
104
|
+
}
|
105
|
+
};
|
106
|
+
SqsWorkerCommand = __decorate([
|
107
|
+
(0, common_1.Injectable)(),
|
108
|
+
__metadata("design:paramtypes", [queue_service_1.QueueService, nestjs_console_1.ConsoleService])
|
109
|
+
], SqsWorkerCommand);
|
110
|
+
exports.SqsWorkerCommand = SqsWorkerCommand;
|
111
|
+
//# sourceMappingURL=sqs.worker.command.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sqs.worker.command.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/sqs.worker.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iCAAiC;AACjC,mDAAgD;AAChD,wEAAgE;AAChE,gFAA4E;AAC5E,kEAA8D;AAG9D,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAQxC,IAAa,gBAAgB,GAA7B,MAAa,gBAAgB;IAUzB,YAA6B,YAA0B,EAAmB,cAA8B;QAA3E,iBAAY,GAAZ,YAAY,CA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;IAEa,eAAe,CAAC,QAAe;;YACzC,KAAK,MAAM,OAAO,IAAI,QAAQ;gBAAE,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACvE,CAAC;KAAA;IAQa,cAAc;;YACxB,MAAM,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;YAE9C,IAAI,MAAM,IAAI,CAAC,YAAY,CAAC,qBAAqB,EAAE,EAAE;gBACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACnB;QACL,CAAC;KAAA;CACJ,CAAA;AAlHY,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAWkC,4BAAY,EAAmC,+BAAc;GAV/F,gBAAgB,CAkH5B;AAlHY,4CAAgB"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { EntityGeneratorCommand } from './commands/entity.generator.command';
|
2
2
|
import { MaintenanceCommand } from './commands/maintenance.command';
|
3
|
+
import { SqsWorkerCommand } from './commands/sqs.worker.command';
|
3
4
|
import { SyncClassCommand } from './commands/sync.class.command';
|
4
5
|
import { EventConsumer } from './consumers/event.consumer';
|
5
6
|
import { JobConsumer } from './consumers/job.consumer';
|
@@ -9,6 +10,7 @@ import { PushNotificationResponseDto } from './dtos/push.notification.response.d
|
|
9
10
|
import { PushNotificationTemplateDto } from './dtos/push.notification.template.dto';
|
10
11
|
import { QueueOptionsDto } from './dtos/queue.options.dto';
|
11
12
|
import { RecordWatcherJob } from './jobs/record.watcher.job';
|
13
|
+
import { TestJob } from './jobs/test.job';
|
12
14
|
import { CreateEntityConstantsFile } from './libraries/create.entity.constants.file';
|
13
15
|
import { CreateEs6ClassesFile } from './libraries/create.es6.classes.file';
|
14
16
|
import { CreateEs6JobsFile } from './libraries/create.es6.jobs.file';
|
@@ -29,16 +31,17 @@ import { QueueService } from './services/queue.service';
|
|
29
31
|
import { RemoteRequestService } from './services/remote.request.service';
|
30
32
|
import { ShutdownService } from './services/shutdown.service';
|
31
33
|
import { SqlService } from './services/sql.service';
|
34
|
+
import { SqsService } from './services/sqs.service';
|
32
35
|
import { StartupService } from './services/startup.service';
|
33
36
|
import { BaseSubscriber } from './subscribers/base.subscriber';
|
34
37
|
declare const es6Classes: {
|
35
|
-
commands: (typeof EntityGeneratorCommand | typeof MaintenanceCommand | typeof SyncClassCommand)[];
|
38
|
+
commands: (typeof EntityGeneratorCommand | typeof MaintenanceCommand | typeof SqsWorkerCommand | typeof SyncClassCommand)[];
|
36
39
|
consumers: (typeof EventConsumer | typeof JobConsumer)[];
|
37
40
|
dtos: (typeof QueueOptionsDto | typeof MailOptionsDto | typeof FcmResponseDto | typeof PushNotificationResponseDto | typeof PushNotificationTemplateDto)[];
|
38
|
-
jobs: (typeof RecordWatcherJob)[];
|
41
|
+
jobs: (typeof TestJob | typeof RecordWatcherJob)[];
|
39
42
|
libraries: (typeof FileSystemUtility | typeof CreateIndexFile | typeof CreateEntityConstantsFile | typeof CreateEs6ClassesFile | typeof CreateEs6JobsFile | typeof CreateEs6ServiceFile)[];
|
40
43
|
middlewares: (typeof MaintenanceMiddleware)[];
|
41
|
-
services: (typeof LocalPropertyService | typeof MaintenanceService | typeof ShutdownService | typeof
|
44
|
+
services: (typeof CacheService | typeof LocalPropertyService | typeof MaintenanceService | typeof ShutdownService | typeof SqsService | typeof QueueService | typeof RemoteRequestService | typeof SqlService | typeof DynamoService | typeof MailService | typeof AuditService | typeof FcmNotificationService | typeof StartupService | typeof Es6JobsService | typeof Es6Service)[];
|
42
45
|
subscribers: (typeof BaseSubscriber)[];
|
43
46
|
};
|
44
47
|
export default es6Classes;
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const entity_generator_command_1 = require("./commands/entity.generator.command");
|
4
4
|
const maintenance_command_1 = require("./commands/maintenance.command");
|
5
|
+
const sqs_worker_command_1 = require("./commands/sqs.worker.command");
|
5
6
|
const sync_class_command_1 = require("./commands/sync.class.command");
|
6
7
|
const event_consumer_1 = require("./consumers/event.consumer");
|
7
8
|
const job_consumer_1 = require("./consumers/job.consumer");
|
@@ -11,6 +12,7 @@ const push_notification_response_dto_1 = require("./dtos/push.notification.respo
|
|
11
12
|
const push_notification_template_dto_1 = require("./dtos/push.notification.template.dto");
|
12
13
|
const queue_options_dto_1 = require("./dtos/queue.options.dto");
|
13
14
|
const record_watcher_job_1 = require("./jobs/record.watcher.job");
|
15
|
+
const test_job_1 = require("./jobs/test.job");
|
14
16
|
const create_entity_constants_file_1 = require("./libraries/create.entity.constants.file");
|
15
17
|
const create_es6_classes_file_1 = require("./libraries/create.es6.classes.file");
|
16
18
|
const create_es6_jobs_file_1 = require("./libraries/create.es6.jobs.file");
|
@@ -31,13 +33,14 @@ const queue_service_1 = require("./services/queue.service");
|
|
31
33
|
const remote_request_service_1 = require("./services/remote.request.service");
|
32
34
|
const shutdown_service_1 = require("./services/shutdown.service");
|
33
35
|
const sql_service_1 = require("./services/sql.service");
|
36
|
+
const sqs_service_1 = require("./services/sqs.service");
|
34
37
|
const startup_service_1 = require("./services/startup.service");
|
35
38
|
const base_subscriber_1 = require("./subscribers/base.subscriber");
|
36
39
|
const es6Classes = {
|
37
|
-
commands: [entity_generator_command_1.EntityGeneratorCommand, maintenance_command_1.MaintenanceCommand, sync_class_command_1.SyncClassCommand],
|
40
|
+
commands: [entity_generator_command_1.EntityGeneratorCommand, maintenance_command_1.MaintenanceCommand, sqs_worker_command_1.SqsWorkerCommand, sync_class_command_1.SyncClassCommand],
|
38
41
|
consumers: [event_consumer_1.EventConsumer, job_consumer_1.JobConsumer],
|
39
42
|
dtos: [fcm_response_dto_1.FcmResponseDto, mail_options_dto_1.MailOptionsDto, push_notification_response_dto_1.PushNotificationResponseDto, push_notification_template_dto_1.PushNotificationTemplateDto, queue_options_dto_1.QueueOptionsDto],
|
40
|
-
jobs: [record_watcher_job_1.RecordWatcherJob],
|
43
|
+
jobs: [record_watcher_job_1.RecordWatcherJob, test_job_1.TestJob],
|
41
44
|
libraries: [create_entity_constants_file_1.CreateEntityConstantsFile, create_es6_classes_file_1.CreateEs6ClassesFile, create_es6_jobs_file_1.CreateEs6JobsFile, create_es6_service_file_1.CreateEs6ServiceFile, create_index_file_1.CreateIndexFile, file_system_utility_1.FileSystemUtility],
|
42
45
|
middlewares: [maintenance_middleware_1.MaintenanceMiddleware],
|
43
46
|
services: [
|
@@ -54,6 +57,7 @@ const es6Classes = {
|
|
54
57
|
remote_request_service_1.RemoteRequestService,
|
55
58
|
shutdown_service_1.ShutdownService,
|
56
59
|
sql_service_1.SqlService,
|
60
|
+
sqs_service_1.SqsService,
|
57
61
|
startup_service_1.StartupService,
|
58
62
|
],
|
59
63
|
subscribers: [base_subscriber_1.BaseSubscriber],
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"es6.classes.js","sourceRoot":"","sources":["../../src/platformUtility/es6.classes.ts"],"names":[],"mappings":";;AAAA,kFAA6E;AAC7E,wEAAoE;AACpE,sEAAiE;AACjE,+DAA2D;AAC3D,2DAAuD;AACvD,8DAAyD;AACzD,8DAAyD;AACzD,0FAAoF;AACpF,0FAAoF;AACpF,gEAA2D;AAC3D,kEAA6D;AAC7D,2FAAqF;AACrF,iFAA2E;AAC3E,2EAAqE;AACrE,iFAA2E;AAC3E,qEAAgE;AAChE,yEAAoE;AACpE,iFAA6E;AAC7E,4DAAwD;AACxD,4DAAwD;AACxD,8DAA0D;AAC1D,kEAA6D;AAC7D,wDAAoD;AACpD,kFAA6E;AAC7E,8EAAyE;AACzE,0DAAsD;AACtD,wEAAoE;AACpE,4DAAwD;AACxD,8EAAyE;AACzE,kEAA8D;AAC9D,wDAAoD;AACpD,gEAA4D;AAC5D,mEAA+D;AAE/D,MAAM,UAAU,GAAG;IACf,QAAQ,EAAE,CAAC,iDAAsB,EAAE,wCAAkB,EAAE,qCAAgB,CAAC;
|
1
|
+
{"version":3,"file":"es6.classes.js","sourceRoot":"","sources":["../../src/platformUtility/es6.classes.ts"],"names":[],"mappings":";;AAAA,k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C;CAChC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
|
@@ -11,4 +11,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
11
11
|
};
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
13
13
|
__exportStar(require("./record.watcher.job"), exports);
|
14
|
+
__exportStar(require("./test.job"), exports);
|
14
15
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platformUtility/jobs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAqC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platformUtility/jobs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAqC;AACrC,6CAA2B"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { CommonJob } from './../../common/libraries/common.job';
|
2
|
+
import { QueueService } from './../services/queue.service';
|
3
|
+
export declare class TestJob extends CommonJob {
|
4
|
+
protected readonly queueService: QueueService;
|
5
|
+
protected mode: string;
|
6
|
+
constructor(queueService: QueueService);
|
7
|
+
handle(data: any): Promise<void>;
|
8
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
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;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
18
|
+
});
|
19
|
+
};
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
21
|
+
exports.TestJob = void 0;
|
22
|
+
const common_1 = require("@nestjs/common");
|
23
|
+
const common_job_1 = require("./../../common/libraries/common.job");
|
24
|
+
const queue_service_1 = require("./../services/queue.service");
|
25
|
+
let TestJob = class TestJob extends common_job_1.CommonJob {
|
26
|
+
constructor(queueService) {
|
27
|
+
super();
|
28
|
+
this.queueService = queueService;
|
29
|
+
this.mode = 'fifo';
|
30
|
+
}
|
31
|
+
handle(data) {
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
33
|
+
global.console.log('data', data);
|
34
|
+
});
|
35
|
+
}
|
36
|
+
};
|
37
|
+
TestJob = __decorate([
|
38
|
+
(0, common_1.Injectable)(),
|
39
|
+
__metadata("design:paramtypes", [queue_service_1.QueueService])
|
40
|
+
], TestJob);
|
41
|
+
exports.TestJob = TestJob;
|
42
|
+
//# sourceMappingURL=test.job.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"test.job.js","sourceRoot":"","sources":["../../../src/platformUtility/jobs/test.job.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,oEAAgE;AAChE,+DAA2D;AAG3D,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,sBAAS;IAGlC,YAA+B,YAA0B;QACrD,KAAK,EAAE,CAAC;QADmB,iBAAY,GAAZ,YAAY,CAAc;QAF/C,SAAI,GAAG,MAAM,CAAC;IAIxB,CAAC;IAEK,MAAM,CAAC,IAAS;;YAClB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACrC,CAAC;KAAA;CACJ,CAAA;AAVY,OAAO;IADnB,IAAA,mBAAU,GAAE;qCAIoC,4BAAY;GAHhD,OAAO,CAUnB;AAVY,0BAAO"}
|
@@ -18,16 +18,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.DynamoService = void 0;
|
19
19
|
const common_1 = require("@nestjs/common");
|
20
20
|
const aws_sdk_1 = require("aws-sdk");
|
21
|
-
const
|
21
|
+
const awsConfig = require("../../config/aws.config");
|
22
22
|
let DynamoService = class DynamoService {
|
23
23
|
constructor() {
|
24
24
|
this.client = null;
|
25
25
|
}
|
26
26
|
init() {
|
27
27
|
this.client = new aws_sdk_1.DynamoDB.DocumentClient({
|
28
|
-
accessKeyId:
|
29
|
-
secretAccessKey:
|
30
|
-
region:
|
28
|
+
accessKeyId: awsConfig.key,
|
29
|
+
secretAccessKey: awsConfig.secret,
|
30
|
+
region: awsConfig.region,
|
31
31
|
});
|
32
32
|
}
|
33
33
|
getClient() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dynamo.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/dynamo.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,qCAAmC;AACnC,
|
1
|
+
{"version":3,"file":"dynamo.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/dynamo.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,qCAAmC;AACnC,qDAAqD;AAQrD,IAAa,aAAa,GAA1B,MAAa,aAAa;IAA1B;QAMY,WAAM,GAAG,IAAI,CAAC;IAkE1B,CAA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GAAE;GACA,aAAa,CAwEzB;AAxEY,sCAAa"}
|
@@ -1,10 +1,12 @@
|
|
1
1
|
import { RecordWatcherJob } from '../jobs/record.watcher.job';
|
2
|
+
import { TestJob } from '../jobs/test.job';
|
2
3
|
import { LocalPropertyService } from '../../platformUtility/services/local.property.service';
|
3
4
|
export declare class Es6JobsService {
|
4
5
|
private readonly recordWatcherJob;
|
6
|
+
private readonly testJob;
|
5
7
|
private readonly localPropertyService;
|
6
8
|
private jobs;
|
7
|
-
constructor(recordWatcherJob: RecordWatcherJob, localPropertyService: LocalPropertyService);
|
9
|
+
constructor(recordWatcherJob: RecordWatcherJob, testJob: TestJob, localPropertyService: LocalPropertyService);
|
8
10
|
alignJobs(): void;
|
9
11
|
setJobs(): void;
|
10
12
|
}
|
@@ -12,10 +12,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Es6JobsService = void 0;
|
13
13
|
const common_1 = require("@nestjs/common");
|
14
14
|
const record_watcher_job_1 = require("../jobs/record.watcher.job");
|
15
|
+
const test_job_1 = require("../jobs/test.job");
|
15
16
|
const local_property_service_1 = require("../../platformUtility/services/local.property.service");
|
16
17
|
let Es6JobsService = class Es6JobsService {
|
17
|
-
constructor(recordWatcherJob, localPropertyService) {
|
18
|
+
constructor(recordWatcherJob, testJob, localPropertyService) {
|
18
19
|
this.recordWatcherJob = recordWatcherJob;
|
20
|
+
this.testJob = testJob;
|
19
21
|
this.localPropertyService = localPropertyService;
|
20
22
|
this.jobs = {};
|
21
23
|
this.alignJobs();
|
@@ -24,6 +26,7 @@ let Es6JobsService = class Es6JobsService {
|
|
24
26
|
alignJobs() {
|
25
27
|
this.jobs = {
|
26
28
|
'3873104b5fa6f9569331cfc3103bda43': this.recordWatcherJob,
|
29
|
+
b20ed62e97fbef22a56c84c4908996a6: this.testJob,
|
27
30
|
};
|
28
31
|
}
|
29
32
|
setJobs() {
|
@@ -33,7 +36,9 @@ let Es6JobsService = class Es6JobsService {
|
|
33
36
|
};
|
34
37
|
Es6JobsService = __decorate([
|
35
38
|
(0, common_1.Injectable)(),
|
36
|
-
__metadata("design:paramtypes", [record_watcher_job_1.RecordWatcherJob,
|
39
|
+
__metadata("design:paramtypes", [record_watcher_job_1.RecordWatcherJob,
|
40
|
+
test_job_1.TestJob,
|
41
|
+
local_property_service_1.LocalPropertyService])
|
37
42
|
], Es6JobsService);
|
38
43
|
exports.Es6JobsService = Es6JobsService;
|
39
44
|
//# sourceMappingURL=es6.jobs.service.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"es6.jobs.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/es6.jobs.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,mEAA8D;AAC9D,kGAA6F;AAQ7F,IAAa,cAAc,GAA3B,MAAa,cAAc;IAGvB,
|
1
|
+
{"version":3,"file":"es6.jobs.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/es6.jobs.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,mEAA8D;AAC9D,+CAA2C;AAC3C,kGAA6F;AAQ7F,IAAa,cAAc,GAA3B,MAAa,cAAc;IAGvB,YACqB,gBAAkC,EAClC,OAAgB,EAChB,oBAA0C;QAF1C,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,YAAO,GAAP,OAAO,CAAS;QAChB,yBAAoB,GAApB,oBAAoB,CAAsB;QALvD,SAAI,GAAG,EAAE,CAAC;QAOd,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;IAMD,SAAS;QACL,IAAI,CAAC,IAAI,GAAG;YACR,kCAAkC,EAAE,IAAI,CAAC,gBAAgB;YACzD,gCAAgC,EAAE,IAAI,CAAC,OAAO;SACjD,CAAC;IACN,CAAC;IAMD,OAAO;QACH,MAAM,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,MAAM,kCAC7B,YAAY,GACZ,IAAI,CAAC,IAAI,EACd,CAAC;IACP,CAAC;CACJ,CAAA;AAlCY,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAK8B,qCAAgB;QACzB,kBAAO;QACM,6CAAoB;GANtD,cAAc,CAkC1B;AAlCY,wCAAc"}
|
@@ -23,4 +23,5 @@ __exportStar(require("./shutdown.service"), exports);
|
|
23
23
|
__exportStar(require("./sql.service"), exports);
|
24
24
|
__exportStar(require("./startup.service"), exports);
|
25
25
|
__exportStar(require("./mail.service"), exports);
|
26
|
+
__exportStar(require("./sql.service"), exports);
|
26
27
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platformUtility/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAgC;AAChC,kDAAgC;AAChC,mDAAiC;AACjC,6DAA2C;AAC3C,2DAAyC;AACzC,iDAA+B;AAC/B,wDAAsC;AACtC,kDAAgC;AAChC,2DAAyC;AACzC,qDAAmC;AACnC,gDAA8B;AAC9B,oDAAkC;AAClC,iDAA+B"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platformUtility/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAgC;AAChC,kDAAgC;AAChC,mDAAiC;AACjC,6DAA2C;AAC3C,2DAAyC;AACzC,iDAA+B;AAC/B,wDAAsC;AACtC,kDAAgC;AAChC,2DAAyC;AACzC,qDAAmC;AACnC,gDAA8B;AAC9B,oDAAkC;AAClC,iDAA+B;AAC/B,gDAA8B"}
|
@@ -1,22 +1,25 @@
|
|
1
|
-
import { LocalPropertyService } from './local.property.service';
|
2
1
|
import { Job, Queue } from 'bull';
|
3
2
|
import { QueueOptionsDto } from '../dtos/queue.options.dto';
|
3
|
+
import { CacheService } from './cache.service';
|
4
|
+
import { LocalPropertyService } from './local.property.service';
|
4
5
|
import { MaintenanceService } from './maintenance.service';
|
5
6
|
import { ShutdownService } from './shutdown.service';
|
6
|
-
import {
|
7
|
+
import { SqsService } from './sqs.service';
|
7
8
|
export declare class QueueService {
|
8
9
|
private readonly businessQueue;
|
9
10
|
private readonly maintenanceService;
|
10
11
|
private readonly shutdownService;
|
11
12
|
private readonly cacheService;
|
12
13
|
private readonly localPropertyService;
|
14
|
+
readonly sqsService: SqsService;
|
13
15
|
data: any;
|
14
16
|
private restartIdentifier;
|
15
17
|
private logger;
|
16
|
-
constructor(businessQueue: Queue, maintenanceService: MaintenanceService, shutdownService: ShutdownService, cacheService: CacheService, localPropertyService: LocalPropertyService);
|
18
|
+
constructor(businessQueue: Queue, maintenanceService: MaintenanceService, shutdownService: ShutdownService, cacheService: CacheService, localPropertyService: LocalPropertyService, sqsService: SqsService);
|
17
19
|
add(type: string, data: any, options?: QueueOptionsDto): Promise<Job>;
|
20
|
+
addJob(type: string, data: any, options?: QueueOptionsDto): Promise<Job | any>;
|
21
|
+
addSqsJob(mode: any, payload: any): Promise<unknown>;
|
18
22
|
getStats(): Promise<any>;
|
19
|
-
addJob(type: string, data: any, options?: QueueOptionsDto): Promise<Job>;
|
20
23
|
pause(): Promise<void>;
|
21
24
|
resume(): Promise<void>;
|
22
25
|
getQueueInstance(): Queue;
|
@@ -22,23 +22,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
22
22
|
};
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
24
24
|
exports.QueueService = void 0;
|
25
|
-
const operation_exception_1 = require("./../../common/exceptions/operation.exception");
|
26
|
-
const local_property_service_1 = require("./local.property.service");
|
27
25
|
const bull_1 = require("@nestjs/bull");
|
28
26
|
const common_1 = require("@nestjs/common");
|
29
27
|
const date_util_1 = require("../../common/libraries/date.util");
|
30
28
|
const platform_constants_1 = require("../../config/platform.constants");
|
29
|
+
const operation_exception_1 = require("./../../common/exceptions/operation.exception");
|
30
|
+
const cache_service_1 = require("./cache.service");
|
31
|
+
const local_property_service_1 = require("./local.property.service");
|
31
32
|
const maintenance_service_1 = require("./maintenance.service");
|
32
33
|
const shutdown_service_1 = require("./shutdown.service");
|
33
|
-
const
|
34
|
+
const sqs_service_1 = require("./sqs.service");
|
35
|
+
const config = require("config");
|
34
36
|
const queueName = platform_constants_1.default.queue;
|
35
37
|
let QueueService = class QueueService {
|
36
|
-
constructor(businessQueue, maintenanceService, shutdownService, cacheService, localPropertyService) {
|
38
|
+
constructor(businessQueue, maintenanceService, shutdownService, cacheService, localPropertyService, sqsService) {
|
37
39
|
this.businessQueue = businessQueue;
|
38
40
|
this.maintenanceService = maintenanceService;
|
39
41
|
this.shutdownService = shutdownService;
|
40
42
|
this.cacheService = cacheService;
|
41
43
|
this.localPropertyService = localPropertyService;
|
44
|
+
this.sqsService = sqsService;
|
42
45
|
this.data = {};
|
43
46
|
this.restartIdentifier = 'queue_restart_time';
|
44
47
|
this.logger = new common_1.Logger('EventQueueManager');
|
@@ -56,11 +59,6 @@ let QueueService = class QueueService {
|
|
56
59
|
return this.businessQueue.add(type, data, options);
|
57
60
|
});
|
58
61
|
}
|
59
|
-
getStats() {
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
61
|
-
return this.data;
|
62
|
-
});
|
63
|
-
}
|
64
62
|
addJob(type, data, options) {
|
65
63
|
return __awaiter(this, void 0, void 0, function* () {
|
66
64
|
const jobInstance = this.localPropertyService.getJob(type);
|
@@ -70,11 +68,25 @@ let QueueService = class QueueService {
|
|
70
68
|
job: type,
|
71
69
|
payload: data,
|
72
70
|
name: jobInstance.constructor.name,
|
71
|
+
time: Date.now(),
|
73
72
|
};
|
73
|
+
if (jobInstance.mode !== 'redis')
|
74
|
+
return this.addSqsJob(jobInstance.mode, payload);
|
74
75
|
options = options !== null && options !== void 0 ? options : {};
|
75
76
|
return this.businessQueue.add('generic.job.trigger', payload, options);
|
76
77
|
});
|
77
78
|
}
|
79
|
+
addSqsJob(mode, payload) {
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
81
|
+
const queue = config.get(`sqs.${mode}`);
|
82
|
+
return this.sqsService.add(queue, payload);
|
83
|
+
});
|
84
|
+
}
|
85
|
+
getStats() {
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
87
|
+
return this.data;
|
88
|
+
});
|
89
|
+
}
|
78
90
|
pause() {
|
79
91
|
return __awaiter(this, void 0, void 0, function* () {
|
80
92
|
return this.businessQueue.pause(true);
|
@@ -258,7 +270,8 @@ QueueService = __decorate([
|
|
258
270
|
__metadata("design:paramtypes", [Object, maintenance_service_1.MaintenanceService,
|
259
271
|
shutdown_service_1.ShutdownService,
|
260
272
|
cache_service_1.CacheService,
|
261
|
-
local_property_service_1.LocalPropertyService
|
273
|
+
local_property_service_1.LocalPropertyService,
|
274
|
+
sqs_service_1.SqsService])
|
262
275
|
], QueueService);
|
263
276
|
exports.QueueService = QueueService;
|
264
277
|
//# sourceMappingURL=queue.service.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"queue.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/queue.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
1
|
+
{"version":3,"file":"queue.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/queue.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA2C;AAC3C,2CAAoD;AAEpD,gEAA4D;AAC5D,wEAAgE;AAEhE,uFAAmF;AACnF,mDAA+C;AAC/C,qEAAgE;AAChE,+DAA2D;AAC3D,yDAAqD;AACrD,+CAA2C;AAC3C,iCAAiC;AAEjC,MAAM,SAAS,GAAG,4BAAiB,CAAC,KAAK,CAAC;AAQ1C,IAAa,YAAY,GAAzB,MAAa,YAAY;IAerB,YAC6C,aAAoB,EAC5C,kBAAsC,EACtC,eAAgC,EAChC,YAA0B,EAC1B,oBAA0C,EAC3C,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AAM,CAAC,KAAK,CAAC,CAAC;YACnD,GAAG,CAAC,MAAM,EAAE,CAAC;QACjB,CAAC;KAAA;IASO,cAAc,CAAC,IAAW;QAC9B,MAAM,QAAQ,GAAG,EAAE,CAAC;QAEpB,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;;YACjB,QAAQ,CAAC,IAAI,CAAC;gBACV,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE;gBACX,IAAI,EAAE,CAAA,MAAA,GAAG,CAAC,IAAI,0CAAE,IAAI,KAAI,GAAG,CAAC,IAAI;gBAChC,UAAU,EAAE,GAAG,CAAC,SAAS;gBACzB,YAAY,EAAE,GAAG,CAAC,WAAW;gBAC7B,WAAW,EAAE,GAAG,CAAC,UAAU;gBAC3B,MAAM,EAAE,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,SAAS;gBACvC,GAAG,EAAE,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,WAAW;gBACrC,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ;aAC9B,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ,CAAA;AA3ZY,YAAY;IADxB,IAAA,mBAAU,GAAE;IAiBJ,WAAA,IAAA,kBAAW,EAAC,SAAS,CAAC,CAAA;6CACc,wCAAkB;QACrB,kCAAe;QAClB,4BAAY;QACJ,6CAAoB;QAC/B,wBAAU;GArBjC,YAAY,CA2ZxB;AA3ZY,oCAAY"}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
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;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
18
|
+
});
|
19
|
+
};
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
21
|
+
exports.SqsService = void 0;
|
22
|
+
const common_1 = require("@nestjs/common");
|
23
|
+
const aws_sdk_1 = require("aws-sdk");
|
24
|
+
const s3Config = require("../../config/aws.config");
|
25
|
+
let SqsService = class SqsService {
|
26
|
+
constructor() {
|
27
|
+
this.client = new aws_sdk_1.SQS({ accessKeyId: s3Config.key, secretAccessKey: s3Config.secret, region: s3Config.region });
|
28
|
+
}
|
29
|
+
add(queue, message) {
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
31
|
+
const params = {
|
32
|
+
MessageGroupId: 'group-1',
|
33
|
+
MessageBody: JSON.stringify(message),
|
34
|
+
QueueUrl: queue,
|
35
|
+
};
|
36
|
+
return this.sendMessage(params);
|
37
|
+
});
|
38
|
+
}
|
39
|
+
delete(queue, receiptHandle) {
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
41
|
+
const deleteParams = {
|
42
|
+
QueueUrl: queue,
|
43
|
+
ReceiptHandle: receiptHandle,
|
44
|
+
};
|
45
|
+
this.client.deleteMessage(deleteParams, () => { });
|
46
|
+
});
|
47
|
+
}
|
48
|
+
get(queue, count = 10) {
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
50
|
+
const params = {
|
51
|
+
QueueUrl: queue,
|
52
|
+
MaxNumberOfMessages: count,
|
53
|
+
VisibilityTimeout: 10,
|
54
|
+
WaitTimeSeconds: 20,
|
55
|
+
};
|
56
|
+
return new Promise((resolve, reject) => {
|
57
|
+
this.client.receiveMessage(params, (err, data) => {
|
58
|
+
if (err)
|
59
|
+
reject(err);
|
60
|
+
else
|
61
|
+
resolve(data);
|
62
|
+
});
|
63
|
+
});
|
64
|
+
});
|
65
|
+
}
|
66
|
+
sendMessage(params) {
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
68
|
+
return new Promise((resolve, reject) => {
|
69
|
+
this.client.sendMessage(params, (err, data) => {
|
70
|
+
if (err) {
|
71
|
+
reject(err);
|
72
|
+
}
|
73
|
+
else {
|
74
|
+
resolve(data.MessageId);
|
75
|
+
}
|
76
|
+
});
|
77
|
+
});
|
78
|
+
});
|
79
|
+
}
|
80
|
+
};
|
81
|
+
SqsService = __decorate([
|
82
|
+
(0, common_1.Injectable)(),
|
83
|
+
__metadata("design:paramtypes", [])
|
84
|
+
], SqsService);
|
85
|
+
exports.SqsService = SqsService;
|
86
|
+
//# sourceMappingURL=sqs.service.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sqs.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/sqs.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,qCAA8B;AAC9B,oDAAoD;AAGpD,IAAa,UAAU,GAAvB,MAAa,UAAU;IAGnB;QACI,IAAI,CAAC,MAAM,GAAG,IAAI,aAAG,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,GAAG,EAAE,eAAe,EAAE,QAAQ,CAAC,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