nestjs-rabbitmq
v1.0.1
Published
nest rabbitmq module
Downloads
512
Maintainers
Readme
Nestjs Rabbitmq
Rabbitmq component for NestJs.
Installation
Yarn
yarn add nestjs-rabbitmq
NPM
npm install nestjs-rabbitmq --save
Getting Started
Let's import the RabbitMqModule in app.module.ts
import { Module } from '@nestjs/common';
import { RabbitMqModule} from 'nestjs-rabbitmq'
@Module({
imports: [
RabbitMqModule.forRoot(options)
],
})
export class AppModule {}
With Async
import { Module } from '@nestjs/common';
import { RabbitMqModule} from 'nestjs-rabbitmq'
@Module({
imports: [
RabbitMqModule.forRootAsync({
useFactory: (configService: ConfigService) => configService.get('rabbitmq'), // or use async method
//useFactory: async (configService: ConfigService) => configService.get('rabbitmq'),
inject:[ConfigService]
}),
],
})
export class AppModule {}
Options
interface RabbitMqModuleOptions {
user?: string, //Default guest
passwd?: string, //Default guest
host?: string, //Default localhost
port?: number //Default 5672
}
That's it!