16 lines
564 B
TypeScript
16 lines
564 B
TypeScript
import { Transport, MicroserviceOptions } from '@nestjs/microservices';
|
|
|
|
export const getRabbitMQOptions = (queueName: string, url?: string): MicroserviceOptions => {
|
|
return {
|
|
transport: Transport.RMQ,
|
|
options: {
|
|
urls: [url || process.env.RABBITMQ_URL || 'amqp://localhost:5672'],
|
|
queue: queueName,
|
|
queueOptions: {
|
|
durable: true, // Черга не зникає при перезавантаженні RabbitMQ
|
|
},
|
|
persistent: true, // Повідомлення зберігаються на диску
|
|
},
|
|
};
|
|
};
|