@seidor-cloud-produtos/orbit-backend-lib 2.0.81 → 2.0.83
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/clean-arch/application/queue/queue-connection.d.ts +5 -0
- package/dist/clean-arch/infra/logger/logger-orbit.js +1 -1
- package/dist/clean-arch/infra/queue/create-consumers.d.ts +4 -0
- package/dist/clean-arch/infra/queue/create-consumers.js +4 -0
- package/dist/clean-arch/infra/queue/create-queues.d.ts +11 -0
- package/dist/clean-arch/infra/queue/create-queues.js +17 -0
- package/package.json +1 -1
|
@@ -2,5 +2,10 @@ import Queue from './queue';
|
|
|
2
2
|
export default interface QueueConnection extends Queue {
|
|
3
3
|
connect(props: unknown): Promise<any>;
|
|
4
4
|
close(): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @deprecated Use createQueues() instead.
|
|
8
|
+
*/
|
|
5
9
|
createConsumers?<T>(queueName: string, configs: T | any): Promise<void>;
|
|
10
|
+
createQueues?<T>(queueName: string, configs: T | any): Promise<void>;
|
|
6
11
|
}
|
|
@@ -29,7 +29,7 @@ class LoggerOrbit extends logger_1.default {
|
|
|
29
29
|
async register(props, data) {
|
|
30
30
|
try {
|
|
31
31
|
const payload = this.buildPayload(props, data);
|
|
32
|
-
await this.queue.publish('
|
|
32
|
+
await this.queue.publish('log-service.direct', new LogEvent(payload));
|
|
33
33
|
}
|
|
34
34
|
catch (error) {
|
|
35
35
|
if (this.options?.retryStrategy) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import QueueConnection from '../../application/queue/queue-connection';
|
|
2
|
+
export interface IQueueProps {
|
|
3
|
+
name: string;
|
|
4
|
+
configs: any;
|
|
5
|
+
}
|
|
6
|
+
export default abstract class CreateQueues {
|
|
7
|
+
readonly queue: QueueConnection;
|
|
8
|
+
protected abstract queues: IQueueProps[];
|
|
9
|
+
constructor(queue: QueueConnection);
|
|
10
|
+
createQueues(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class CreateQueues {
|
|
4
|
+
queue;
|
|
5
|
+
constructor(queue) {
|
|
6
|
+
this.queue = queue;
|
|
7
|
+
}
|
|
8
|
+
async createQueues() {
|
|
9
|
+
if (!this.queue.createQueues) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
for (const queue of this.queues) {
|
|
13
|
+
await this.queue.createQueues(queue.name, queue.configs);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = CreateQueues;
|