What problem does it solve?
This guide removes guesswork and prevents common mistakes when adding BullMQ queue processors and QueueServices to zoppy-api by documenting required session propagation, locking patterns, registration rules, and logging/retry expectations so background jobs run correctly and reliably.
Core Features & Use Cases
- Create a Request-scoped QueueService that enqueues jobs with standardized QueueEnum and QueueJobEnum values and uses centralized enqueue helpers and retry presets.
- Implement processors by extending QueueProcessorBase for normal jobs or ProviderQueueProcessorBase for exclusive per-company/provider processing with Redis locks and expiration.
- Ensure correct session propagation by calling setSession(job) at the start of process, configure concurrency and lockDuration, use structured logging and error re-throwing for retries, and register processors in exactly one pipeline module to avoid duplicate consumption.
- Common use cases: asynchronous provider syncs, message sending pipelines (WhatsApp/SMS/email), workflow execution steps, campaign processing, and general background tasks.
Quick Start
Create a Request-scoped QueueService and a Processor that calls await this.setSession(job) first, configures concurrency and lockDuration, uses the appropriate QueueJobEnum and QueueEnum, and registers the queue and processor in the correct module so jobs process reliably.