ajustes rabbitmq

This commit is contained in:
Davidson Gomes 2024-03-08 10:54:11 -03:00
parent 8f7c518487
commit 060c4e6e72
2 changed files with 6 additions and 6 deletions

View File

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

View File

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