MΓ³dulo 11 Β· Streams & Background Jobs β LecciΓ³n 3 de 3 Β· ~8 min
The worker: process, retry, and fail safely
The other half: a processor pulls jobs off
The producer put a job in Redis. Now something has to take it out and do the work. In @nestjs/bullmq that's a processor: a class decorated with @Processor("emails") that extends WorkerHost and implements one process(job) method. Nest spins up a BullMQ worker bound to that queue and calls process for every job.
One process method handles every job on the queue; you branch on job.name when a queue carries more than one kind of work. The job's payload is on job.data β for us, { bookingId }.
Note: the older
@nestjs/bullpackage used a per-method@Process("name")decorator. Modern@nestjs/bullmqgives each processor a singleprocess()method instead β switch onjob.nameinside it.