From 060c4e6e723489d5380ae85afe3323887dde0096 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Fri, 8 Mar 2024 10:54:11 -0300 Subject: [PATCH] ajustes rabbitmq --- src/config/env.config.ts | 4 ++-- src/libs/amqp.server.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/config/env.config.ts b/src/config/env.config.ts index db9edf9b..1baac567 100644 --- a/src/config/env.config.ts +++ b/src/config/env.config.ts @@ -71,7 +71,7 @@ export type Redis = { export type Rabbitmq = { ENABLED: boolean; - MODE: 'isolated' | 'global' | 'single'; + MODE: string; // global, single, isolated EXCHANGE_NAME: string; // available for global and single, isolated mode will use instance name as exchange URI: string; }; @@ -285,7 +285,7 @@ export class ConfigService { }, RABBITMQ: { ENABLED: process.env?.RABBITMQ_ENABLED === 'true', - MODE: (process.env?.RABBITMQ_MODE as 'isolated' | 'global' | 'single') || 'isolated', + MODE: process.env?.RABBITMQ_MODE || 'isolated', EXCHANGE_NAME: process.env?.RABBITMQ_EXCHANGE_NAME || 'evolution_exchange', URI: process.env.RABBITMQ_URI || '', }, diff --git a/src/libs/amqp.server.ts b/src/libs/amqp.server.ts index 361d4c12..3c7c7098 100644 --- a/src/libs/amqp.server.ts +++ b/src/libs/amqp.server.ts @@ -63,7 +63,7 @@ export const getAMQP = (): Channel | null => { export const initQueues = (instanceName: string, events: string[]) => { if (!instanceName || !events || !events.length) return; const rabbitConfig = configService.get('RABBITMQ'); - // const TWO_DAYS_IN_MS = 2 * 24 * 60 * 60 * 1000; + const TWO_DAYS_IN_MS = 2 * 24 * 60 * 60 * 1000; const amqp = getAMQP(); const rabbitMode = rabbitConfig.MODE || 'isolated'; @@ -83,7 +83,7 @@ export const initQueues = (instanceName: string, events: string[]) => { amqp.assertQueue(queueName, { durable: true, autoDelete: false, - // messageTtl: TWO_DAYS_IN_MS, + messageTtl: TWO_DAYS_IN_MS, arguments: { 'x-queue-type': 'quorum', }, @@ -101,7 +101,7 @@ export const initQueues = (instanceName: string, events: string[]) => { amqp.assertQueue(queueName, { durable: true, autoDelete: false, - // messageTtl: TWO_DAYS_IN_MS, + messageTtl: TWO_DAYS_IN_MS, arguments: { 'x-queue-type': 'quorum', }, @@ -135,7 +135,7 @@ export const initQueues = (instanceName: string, events: string[]) => { amqp.assertQueue(queueName, { durable: true, autoDelete: false, - // messageTtl: TWO_DAYS_IN_MS, + messageTtl: TWO_DAYS_IN_MS, arguments: { 'x-queue-type': 'quorum', },