@seidor-cloud-produtos/orbit-backend-lib 0.0.51 → 0.0.52

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.
@@ -29,17 +29,21 @@ class AmqpQueue {
29
29
  const channel = await this.connection.createChannel();
30
30
  this.channels.push(channel);
31
31
  await channel.prefetch(callback.getSimultaneity());
32
- await channel.consume(queueName, async message => {
33
- try {
34
- await callback.handle(JSON.parse(message?.content.toString()));
35
- channel.ack(message);
36
- } catch (_) {
37
- if (process.env.NODE_ENV === 'test') {
38
- return;
32
+ await channel
33
+ .consume(queueName, async message => {
34
+ try {
35
+ await callback.handle(JSON.parse(message?.content.toString()));
36
+ channel.ack(message);
37
+ } catch (_) {
38
+ if (process.env.NODE_ENV === 'test') {
39
+ return;
40
+ }
41
+ this.channels.length !== 0 && channel.reject(message, false);
39
42
  }
40
- this.channels.length !== 0 && channel.reject(message, false);
41
- }
42
- });
43
+ })
44
+ .catch(_ => {
45
+ console.log(`💀 Error on Channel`);
46
+ });
43
47
  console.log(`🍯 Consume on queue: [${queueName}] on vHost ${this.vHost}`);
44
48
  } catch (err) {
45
49
  console.log(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seidor-cloud-produtos/orbit-backend-lib",
3
- "version": "0.0.51",
3
+ "version": "0.0.52",
4
4
  "description": "Internal lib for backend components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",