1.7.0 • Published 10 months ago

@xnestjs/rabbitmq v1.7.0

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

@xnestjs/rabbitmq

NestJS extension library for RabbitMQ

Install

npm install @xnestjs/rabbitmq
# or using yarn
yarn add @xnestjs/rabbitmq

Usage

Register sync

An example of nestjs module that import the @xnestjs/rabbitmq

// module.ts
import { Module } from '@nestjs/common';
import { RabbitmqModule } from '@xnestjs/rabbitmq';

@Module({
    imports: [
        RabbitmqModule.forRoot({
            useValue: {
                urls: ['amqp://localhost:5672'],
            },
        }),
    ],
})
export class MyModule {
}

Register async

An example of nestjs module that import the @xnestjs/rabbitmq async

// module.ts
import { Module } from '@nestjs/common';
import { RabbitmqModule } from '@xnestjs/rabbitmq';

@Module({
    imports: [
        RabbitmqModule.forRootAsync({
            inject: [ConfigModule],
            useFactory: (config: ConfigService) => ({
                urls: config.get('RMQ_URLS'),
            }),
        }),
    ]
})
export class MyModule {
}

Environment Variables

The library supports configuration through environment variables. Environment variables below is accepted. All environment variables starts with prefix (RMQ_). This can be configured while registering the module.

<--- BEGIN env --->

Environment VariableTypeDefaultDescription
RMQ_URLSString[]!
RMQ_PREFETCH_COUNTNumber
RMQ_MAX_CONNECTION_ATTEMPTSNumber
RMQ_RECONNECT_TIMENumber
RMQ_HEARTBEAT_INTERVALNumber

<--- END env --->

1.7.0

10 months ago

1.6.4

10 months ago

1.6.3

10 months ago

1.6.2

10 months ago

1.5.3

10 months ago

1.6.1

10 months ago

1.5.2

10 months ago

1.6.0

10 months ago

1.5.1

10 months ago