What is the NestJS Queue module?
Answer
The @nestjs/bull module integrates the Bull queue library (backed by Redis) for background job processing. Register a queue: BullModule.registerQueue({ name: 'email' }). Add jobs to the queue in a service: @InjectQueue('email') private emailQueue: Queue; await this.emailQueue.add('send-welcome', { userId: id });. Create a processor: @Processor('email') class EmailProcessor { @Process('send-welcome') async handle(job: Job) { await this.sendEmail(job.data.userId); } }. Bull supports priority queues, job delays, retry on failure, concurrency control, rate limiting, and scheduled jobs. The newer @nestjs/bullmq package uses BullMQ, a rewrite of Bull with better TypeScript support.
Previous
How do you implement WebSocket support in NestJS?
Next
How do you write unit tests in NestJS?
More NestJS Questions
View all →- Intermediate How does NestJS dependency injection scoping work?
- Intermediate What are NestJS microservices and what transports are supported?
- Intermediate What is the ExecutionContext in NestJS?
- Intermediate How do you implement role-based access control (RBAC) in NestJS?
- Intermediate What is the Reflector in NestJS and how is it used?