import { NestFactory } from '@nestjs/core' ; import { MicroserviceOptions , Transport } from '@nestjs/microservices' ; import { ConfigService } from '@fc/config' ; import { CsmrTracksConfig } from '@fc/csmr-tracks' ; import { RabbitmqConfig } from '@fc/rabbitmq' ; import { AppModule } from './app.module' ; import configuration from './config' ; async function bootstrap ( ) { const configOptions = { isGlobal : false , config : configuration , schema : CsmrTracksConfig , } ; const configService = new ConfigService ( configOptions ) ; const options = configService . get < RabbitmqConfig > ( 'TracksBroker' ) ; const appModule = AppModule . forRoot ( configService ) ; const consumer = await NestFactory . createMicroservice < MicroserviceOptions > ( appModule , { transport : Transport . RMQ , options , } ) ; await consumer . listen ( ) ; console . log ( `Consumer is listening on queue "${ options . queue }"` ) ; } bootstrap ( ) ;