mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 01:41:24 -06:00
rabbitmq
This commit is contained in:
parent
70d4eb393f
commit
950803b2aa
@ -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",
|
||||
|
@ -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();
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user