NestJs

There is a compatible module to be used in NestJs.

npm i @nestjs/bullmq

Once the installation process is complete, we can import the BullModule into the root AppModule.

import { Module } from '@nestjs/common';
import { BullModule } from '@nestjs/bullmq';

@Module({
  imports: [
    BullModule.forRoot({
      connection: {
        host: 'localhost',
        port: 6379,
      },
    }),
  ],
})
export class AppModule {}

To register a queue, import the BullModule.registerQueue() dynamic module, as follows:

BullModule.registerQueue({
  name: 'queueName',
});

To register a flow producer, import the BullModule.registerFlowProducer() dynamic module, as follows:

Processor

To register a processor, you may need to use the Processor decorator:

And then register it as a provider:

Read more:

Last updated

Was this helpful?