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:
Davidson Gomes 2025-05-25 11:10:40 -03:00 committed by GitHub
commit 623efd86a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 1 deletions

View File

@ -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

View File

@ -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);

View File

@ -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',