Basic Producer
Inject the queue into your service
Use the
@InjectQueue() decorator to inject a queue by name:The
@InjectQueue() decorator identifies the queue by its name, as provided in registerQueue().Complete Producer Example
audio.service.ts
Job Options
Customize job behavior with various options:- Priority
- Delay
- Attempts & Backoff
- Remove on Complete
Flow Producers
For complex workflows with parent-child job relationships, use FlowProducer:Inject the FlowProducer
The
@InjectFlowProducer() decorator identifies the flow producer by its name, as provided in registerFlowProducer().Bulk Job Operations
Add multiple jobs efficiently:Controller Example
Integrate producers with NestJS controllers:audio.controller.ts
Best Practices
Job IDs
Use custom job IDs for deduplication:
Error Handling
Always handle errors when adding jobs:
Job Options
Set appropriate timeouts and attempts:
Auto-removal
Clean up completed jobs automatically:
Related Resources
NestJS Integration
Learn about NestJS integration basics
Queue Events
Listen to queue events in NestJS
External Documentation
NestJS Queues Documentation
Official NestJS documentation for queue integration
