mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 07:04:50 -06:00
Merge pull request #1498 from thrsouza/main
Inclusão do parâmetro frame_max para compatibilidade com RabbitMQ 4.1+
This commit is contained in:
commit
623efd86a2
@ -50,6 +50,7 @@ DATABASE_DELETE_MESSAGE=true
|
||||
RABBITMQ_ENABLED=false
|
||||
RABBITMQ_URI=amqp://localhost
|
||||
RABBITMQ_EXCHANGE_NAME=evolution
|
||||
RABBITMQ_FRAME_MAX=8192
|
||||
# Global events - By enabling this variable, events from all instances are sent in the same event queue.
|
||||
RABBITMQ_GLOBAL_ENABLED=false
|
||||
# Prefix key to queue name
|
||||
|
@ -21,9 +21,21 @@ export class RabbitmqController extends EventController implements EventControll
|
||||
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const uri = configService.get<Rabbitmq>('RABBITMQ').URI;
|
||||
const frameMax = configService.get<Rabbitmq>('RABBITMQ').FRAME_MAX;
|
||||
const rabbitmqExchangeName = configService.get<Rabbitmq>('RABBITMQ').EXCHANGE_NAME;
|
||||
|
||||
amqp.connect(uri, (error, connection) => {
|
||||
const url = new URL(uri);
|
||||
const connectionOptions = {
|
||||
protocol: url.protocol.slice(0, -1),
|
||||
hostname: url.hostname,
|
||||
port: url.port || 5672,
|
||||
username: url.username || 'guest',
|
||||
password: url.password || 'guest',
|
||||
vhost: url.pathname.slice(1) || '/',
|
||||
frameMax: frameMax
|
||||
};
|
||||
|
||||
amqp.connect(connectionOptions, (error, connection) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
|
||||
|
@ -95,6 +95,7 @@ export type EventsRabbitmq = {
|
||||
export type Rabbitmq = {
|
||||
ENABLED: boolean;
|
||||
URI: string;
|
||||
FRAME_MAX: number;
|
||||
EXCHANGE_NAME: string;
|
||||
GLOBAL_ENABLED: boolean;
|
||||
EVENTS: EventsRabbitmq;
|
||||
@ -391,6 +392,7 @@ export class ConfigService {
|
||||
PREFIX_KEY: process.env?.RABBITMQ_PREFIX_KEY,
|
||||
EXCHANGE_NAME: process.env?.RABBITMQ_EXCHANGE_NAME || 'evolution_exchange',
|
||||
URI: process.env.RABBITMQ_URI || '',
|
||||
FRAME_MAX: Number.parseInt(process.env.RABBITMQ_FRAME_MAX) || 8192,
|
||||
EVENTS: {
|
||||
APPLICATION_STARTUP: process.env?.RABBITMQ_EVENTS_APPLICATION_STARTUP === 'true',
|
||||
INSTANCE_CREATE: process.env?.RABBITMQ_EVENTS_INSTANCE_CREATE === 'true',
|
||||
|
Loading…
Reference in New Issue
Block a user