mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-24 17:38:40 -06:00
rabbitmq
This commit is contained in:
parent
0b23153316
commit
ec7986420d
@ -10,7 +10,6 @@ let amqpChannel: amqp.Channel | null = null;
|
|||||||
export const initAMQP = () => {
|
export const initAMQP = () => {
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
const uri = configService.get<Rabbitmq>('RABBITMQ').URI;
|
const uri = configService.get<Rabbitmq>('RABBITMQ').URI;
|
||||||
const exchangeName = configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME ?? 'evolution_exchange';
|
|
||||||
amqp.connect(uri, (error, connection) => {
|
amqp.connect(uri, (error, connection) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
@ -23,6 +22,8 @@ export const initAMQP = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const exchangeName = 'evolution_exchange';
|
||||||
|
|
||||||
channel.assertExchange(exchangeName, 'topic', {
|
channel.assertExchange(exchangeName, 'topic', {
|
||||||
durable: true,
|
durable: true,
|
||||||
autoDelete: false,
|
autoDelete: false,
|
||||||
@ -50,7 +51,7 @@ export const initQueues = (instanceName: string, events: string[]) => {
|
|||||||
|
|
||||||
queues.forEach((event) => {
|
queues.forEach((event) => {
|
||||||
const amqp = getAMQP();
|
const amqp = getAMQP();
|
||||||
const exchangeName = configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME ?? instanceName;
|
const exchangeName = instanceName ?? 'evolution_exchange';
|
||||||
|
|
||||||
amqp.assertExchange(exchangeName, 'topic', {
|
amqp.assertExchange(exchangeName, 'topic', {
|
||||||
durable: true,
|
durable: true,
|
||||||
@ -80,7 +81,7 @@ export const removeQueues = (instanceName: string, events: string[]) => {
|
|||||||
return `${event.replace(/_/g, '.').toLowerCase()}`;
|
return `${event.replace(/_/g, '.').toLowerCase()}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const exchangeName = configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME ?? instanceName;
|
const exchangeName = instanceName ?? 'evolution_exchange';
|
||||||
|
|
||||||
queues.forEach((event) => {
|
queues.forEach((event) => {
|
||||||
const amqp = getAMQP();
|
const amqp = getAMQP();
|
||||||
|
@ -13,7 +13,6 @@ import {
|
|||||||
Database,
|
Database,
|
||||||
HttpServer,
|
HttpServer,
|
||||||
Log,
|
Log,
|
||||||
Rabbitmq,
|
|
||||||
Sqs,
|
Sqs,
|
||||||
Webhook,
|
Webhook,
|
||||||
Websocket,
|
Websocket,
|
||||||
@ -686,7 +685,7 @@ export class WAStartupService {
|
|||||||
|
|
||||||
if (amqp) {
|
if (amqp) {
|
||||||
if (Array.isArray(rabbitmqLocal) && rabbitmqLocal.includes(we)) {
|
if (Array.isArray(rabbitmqLocal) && rabbitmqLocal.includes(we)) {
|
||||||
const exchangeName = this.configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME ?? this.instanceName;
|
const exchangeName = this.instanceName ?? 'evolution_exchange';
|
||||||
|
|
||||||
amqp.assertExchange(exchangeName, 'topic', {
|
amqp.assertExchange(exchangeName, 'topic', {
|
||||||
durable: true,
|
durable: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user