NestJs
Last updated
Was this helpful?
Was this helpful?
BullModule.registerFlowProducer({
name: 'flowProducerName',
});import { Processor, WorkerHost, OnWorkerEvent } from '@nestjs/bullmq';
import { Job } from 'bullmq';
@Processor('queueName')
class TestProcessor extends WorkerHost {
async process(job: Job<any, any, string>): Promise<any> {
// do some stuff
}
@OnWorkerEvent('completed')
onCompleted() {
// do some stuff
}
}@Module({
imports: [
BullModule.registerQueue({
name: 'queueName',
connection: {
host: '0.0.0.0',
port: 6380,
},
}),
BullModule.registerFlowProducer({
name: 'flowProducerName',
connection: {
host: '0.0.0.0',
port: 6380,
},
}),
],
providers: [TestProcessor],
})
export class AppModule {}