@seidor-cloud-produtos/orbit-backend-lib 2.0.63 → 2.0.65
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.
|
@@ -27,7 +27,12 @@ class AmqpQueue {
|
|
|
27
27
|
const urlConnection = `${this.uri}${vHost === '/' ? '/' : `/${vHost}`}`;
|
|
28
28
|
this.connection = await amqplib_1.default.connect(urlConnection, this.socketOptions);
|
|
29
29
|
this.vHost = vHost;
|
|
30
|
-
|
|
30
|
+
this.connection.on('error', async (e) => {
|
|
31
|
+
return await this.treatReconnection(vHost);
|
|
32
|
+
});
|
|
33
|
+
this.connection.on('close', async () => {
|
|
34
|
+
return await this.treatReconnection(vHost);
|
|
35
|
+
});
|
|
31
36
|
if (process.env.NODE_ENV !== 'test') {
|
|
32
37
|
this.logger.info(`⚙️ PROCESS ${this.vHost} PID: `, process.pid);
|
|
33
38
|
this.logger.info(`🐝 Queue connected on vHost: ${this.vHost}`);
|
|
@@ -184,23 +189,11 @@ class AmqpQueue {
|
|
|
184
189
|
return AmqpQueue.instance;
|
|
185
190
|
}
|
|
186
191
|
async treatReconnection(vHost) {
|
|
187
|
-
this.
|
|
188
|
-
this.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
try {
|
|
193
|
-
AmqpQueue.instance = await this.connect(vHost);
|
|
194
|
-
this.controller;
|
|
195
|
-
await this.reconnectionChannels();
|
|
196
|
-
await this.publishMessagesOfMemory();
|
|
197
|
-
clearInterval(interval);
|
|
198
|
-
}
|
|
199
|
-
catch {
|
|
200
|
-
this.logger.info(`🔄 Trying to connection to the vHost: ${vHost}`);
|
|
201
|
-
}
|
|
202
|
-
}, 5000);
|
|
203
|
-
});
|
|
192
|
+
this.logger.info('⛔ Connection Error!!');
|
|
193
|
+
this.logger.info(`🔄 Try connection to the vHost ${vHost}`);
|
|
194
|
+
AmqpQueue.instance = await this.connect(vHost);
|
|
195
|
+
await this.reconnectionChannels();
|
|
196
|
+
await this.publishMessagesOfMemory();
|
|
204
197
|
}
|
|
205
198
|
async reconnectionChannels() {
|
|
206
199
|
for (const [queueName, callback] of this.channels) {
|
|
@@ -31,7 +31,10 @@ class ExpressMappingModel extends mapping_model_1.MappingModel {
|
|
|
31
31
|
return this;
|
|
32
32
|
}
|
|
33
33
|
deleteParams() {
|
|
34
|
-
|
|
34
|
+
const body = this.getBody();
|
|
35
|
+
if (body) {
|
|
36
|
+
delete this.getBody()['api-gateway-params'];
|
|
37
|
+
}
|
|
35
38
|
return this;
|
|
36
39
|
}
|
|
37
40
|
setBody() {
|