Skip to content

Commit 950803b

Browse files
committed
rabbitmq
1 parent 70d4eb3 commit 950803b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"cross-env": "^7.0.3",
5757
"dayjs": "^1.11.7",
5858
"eventemitter2": "^6.4.9",
59-
"evolution-manager": "^0.4.11",
59+
"evolution-manager": "^0.4.13",
6060
"exiftool-vendored": "^22.0.0",
6161
"express": "^4.18.2",
6262
"express-async-errors": "^3.1.1",

src/libs/amqp.server.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ let amqpChannel: amqp.Channel | null = null;
1010
export const initAMQP = () => {
1111
return new Promise<void>((resolve, reject) => {
1212
const uri = configService.get<Rabbitmq>('RABBITMQ').URI;
13+
const exchangeName = configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME ?? 'evolution_exchange';
1314
amqp.connect(uri, (error, connection) => {
1415
if (error) {
1516
reject(error);
@@ -22,8 +23,6 @@ export const initAMQP = () => {
2223
return;
2324
}
2425

25-
const exchangeName = 'evolution_exchange';
26-
2726
channel.assertExchange(exchangeName, 'topic', {
2827
durable: true,
2928
autoDelete: false,
@@ -51,7 +50,7 @@ export const initQueues = (instanceName: string, events: string[]) => {
5150

5251
queues.forEach((event) => {
5352
const amqp = getAMQP();
54-
const exchangeName = instanceName ?? 'evolution_exchange';
53+
const exchangeName = configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME ?? instanceName;
5554

5655
amqp.assertExchange(exchangeName, 'topic', {
5756
durable: true,
@@ -81,7 +80,7 @@ export const removeQueues = (instanceName: string, events: string[]) => {
8180
return `${event.replace(/_/g, '.').toLowerCase()}`;
8281
});
8382

84-
const exchangeName = instanceName ?? 'evolution_exchange';
83+
const exchangeName = configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME ?? instanceName;
8584

8685
queues.forEach((event) => {
8786
const amqp = getAMQP();

src/whatsapp/services/whatsapp.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
Database,
1414
HttpServer,
1515
Log,
16+
Rabbitmq,
1617
Sqs,
1718
Webhook,
1819
Websocket,
@@ -685,7 +686,7 @@ export class WAStartupService {
685686

686687
if (amqp) {
687688
if (Array.isArray(rabbitmqLocal) && rabbitmqLocal.includes(we)) {
688-
const exchangeName = this.instanceName ?? 'evolution_exchange';
689+
const exchangeName = this.configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME ?? this.instanceName;
689690

690691
amqp.assertExchange(exchangeName, 'topic', {
691692
durable: true,

0 commit comments

Comments
 (0)