NestJS
NestJS 异步任务调度:Cron 定时任务与 BullMQ 分布式延迟队列
Waitwalker2026-08-2714 min
## 1. BullMQ 队列生产者与消费者
```typescript
@Injectable()
export class AudioService {
constructor(@InjectQueue("audio") private audioQueue: Queue) {}
async transcode(file: string) {
await this.audioQueue.add("transcode", { file }, { delay: 5000, attempts: 3 });
}
}
```
#NestJS#BullMQ#Cron#异步队列
回到文章列表 →