fear: nats log promihous

This commit is contained in:
mozzie 2023-10-10 21:38:59 +08:00
parent 90a3fd5861
commit 3ba9704741
15 changed files with 90 additions and 56 deletions

View File

@ -27,11 +27,13 @@ import { ForbiddenExceptionFilter } from './filter/forbid.filter';
ClientsModule.register([ ClientsModule.register([
{ {
name: 'Client', name: 'Client',
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
]), ]),

View File

@ -8,11 +8,13 @@ import { ClientsModule, Transport } from '@nestjs/microservices';
ClientsModule.register([ ClientsModule.register([
{ {
name: 'Client', name: 'Client',
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
]), ]),

View File

@ -6,11 +6,13 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice<MicroserviceOptions>( const app = await NestFactory.createMicroservice<MicroserviceOptions>(
AppModule, AppModule,
{ {
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], // 可以指定链接到多个nats的消息队列 urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
); );

View File

@ -6,11 +6,13 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice<MicroserviceOptions>( const app = await NestFactory.createMicroservice<MicroserviceOptions>(
AppModule, AppModule,
{ {
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], // 可以指定链接到多个nats的消息队列 urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
); );

View File

@ -6,11 +6,13 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice<MicroserviceOptions>( const app = await NestFactory.createMicroservice<MicroserviceOptions>(
AppModule, AppModule,
{ {
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], // 可以指定链接到多个nats的消息队列 urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
); );

View File

@ -8,11 +8,13 @@ import { ClientsModule, Transport } from '@nestjs/microservices';
ClientsModule.register([ ClientsModule.register([
{ {
name: 'Client', name: 'Client',
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
]), ]),

View File

@ -21,11 +21,13 @@ import { AdminModule } from './admin/admin.module';
ClientsModule.register([ ClientsModule.register([
{ {
name: 'Client', name: 'Client',
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
]), ]),

View File

@ -6,11 +6,13 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice<MicroserviceOptions>( const app = await NestFactory.createMicroservice<MicroserviceOptions>(
AppModule, AppModule,
{ {
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], // 可以指定链接到多个nats的消息队列 urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
); );

View File

@ -6,11 +6,13 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice<MicroserviceOptions>( const app = await NestFactory.createMicroservice<MicroserviceOptions>(
AppModule, AppModule,
{ {
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], // 可以指定链接到多个nats的消息队列 urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
); );

View File

@ -7,11 +7,13 @@ import { ClientsModule, Transport } from '@nestjs/microservices';
ClientsModule.register([ ClientsModule.register([
{ {
name: 'Client', name: 'Client',
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
]), ]),

View File

@ -7,11 +7,13 @@ import { ClientsModule, Transport } from '@nestjs/microservices';
ClientsModule.register([ ClientsModule.register([
{ {
name: 'Client', name: 'Client',
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
]), ]),

View File

@ -21,11 +21,13 @@ import * as cookieParser from 'cookie-parser';
ClientsModule.register([ ClientsModule.register([
{ {
name: 'Client', name: 'Client',
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
]), ]),

View File

@ -7,11 +7,13 @@ import { ClientsModule, Transport } from '@nestjs/microservices';
ClientsModule.register([ ClientsModule.register([
{ {
name: 'Client', name: 'Client',
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
]), ]),

View File

@ -6,11 +6,13 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice<MicroserviceOptions>( const app = await NestFactory.createMicroservice<MicroserviceOptions>(
AppModule, AppModule,
{ {
transport: Transport.NATS, transport: Transport.RMQ,
options: { options: {
servers: ['nats://localhost:4222'], // 可以指定链接到多个nats的消息队列 urls: ['amqp://localhost:5672'],
maxReconnectAttempts: 5, queue: 'cats_queue',
reconnectTimeWait: 1000, queueOptions: {
durable: false,
},
}, },
}, },
); );

View File

@ -11,6 +11,12 @@ services:
environment: environment:
- RABBITMQ_DEFAULT_USER=guest - RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest - RABBITMQ_DEFAULT_PASS=guest
# volumes:
# - rabbitmq-data:/var/lib/rabbitmq
command: >
bash -c "rabbitmq-plugins enable rabbitmq_management &&
rabbitmq-plugins enable rabbitmq_tracing &&
rabbitmq-server"
mongodb: mongodb:
image: mongo:5.0 image: mongo:5.0