This commit is contained in:
Davidson Gomes 2024-03-27 09:54:05 -03:00
parent 70d4eb393f
commit 950803b2aa
3 changed files with 6 additions and 6 deletions

View File

@ -56,7 +56,7 @@
"cross-env": "^7.0.3",
"dayjs": "^1.11.7",
"eventemitter2": "^6.4.9",
"evolution-manager": "^0.4.11",
"evolution-manager": "^0.4.13",
"exiftool-vendored": "^22.0.0",
"express": "^4.18.2",
"express-async-errors": "^3.1.1",

View File

@ -10,6 +10,7 @@ let amqpChannel: amqp.Channel | null = null;
export const initAMQP = () => {
return new Promise<void>((resolve, reject) => {
const uri = configService.get<Rabbitmq>('RABBITMQ').URI;
const exchangeName = configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME ?? 'evolution_exchange';
amqp.connect(uri, (error, connection) => {
if (error) {
reject(error);
@ -22,8 +23,6 @@ export const initAMQP = () => {
return;
}
const exchangeName = 'evolution_exchange';
channel.assertExchange(exchangeName, 'topic', {
durable: true,
autoDelete: false,
@ -51,7 +50,7 @@ export const initQueues = (instanceName: string, events: string[]) => {
queues.forEach((event) => {
const amqp = getAMQP();
const exchangeName = instanceName ?? 'evolution_exchange';
const exchangeName = configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME ?? instanceName;
amqp.assertExchange(exchangeName, 'topic', {
durable: true,
@ -81,7 +80,7 @@ export const removeQueues = (instanceName: string, events: string[]) => {
return `${event.replace(/_/g, '.').toLowerCase()}`;
});
const exchangeName = instanceName ?? 'evolution_exchange';
const exchangeName = configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME ?? instanceName;
queues.forEach((event) => {
const amqp = getAMQP();

View File

@ -13,6 +13,7 @@ import {
Database,
HttpServer,
Log,
Rabbitmq,
Sqs,
Webhook,
Websocket,
@ -685,7 +686,7 @@ export class WAStartupService {
if (amqp) {
if (Array.isArray(rabbitmqLocal) && rabbitmqLocal.includes(we)) {
const exchangeName = this.instanceName ?? 'evolution_exchange';
const exchangeName = this.configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME ?? this.instanceName;
amqp.assertExchange(exchangeName, 'topic', {
durable: true,