Background Jobs
BullMQ job queues with Redis for async processing. Services are reused in job processors via Dependency Injection.
Job System Structure
All job infrastructure lives in backend/src/lib/jobs/:
| File | Purpose |
|---|---|
factory.ts | Worker creation and lifecycle |
config.ts | Queue configuration (concurrency, retries, backoff) |
types.ts | Job type definitions and payload interfaces |
schedulers.ts | Cron-like scheduled job registration |
health.ts | Queue health monitoring and metrics |
index.ts | Public API exports |
Queues
| Queue | Purpose | Processor |
|---|---|---|
notifications | Email/SMS dispatch | processors/notifications.ts |
pdf | PDF generation/conversion | processors/pdf-conversion.ts |
renditions | Image thumbnail generation | processors/rendition.ts |
hubspot-sync | HubSpot CRM synchronization | processors/hubspotSyncProcessor.ts |
Additional processors handle specialized tasks:
| Processor | Purpose |
|---|---|
entra-sync.ts | Azure Entra directory sync |
document-reminder.ts | Document Obtaining reminder emails |
escalation-scheduler.ts | SLA escalation checks |
reminder-scheduler.ts | Appointment reminders |
rejection-bundle.ts | Batch rejection notifications |
token-cleanup.ts | Expired token removal |
Specialized Queues
- HubSpot sync:
backend/src/lib/jobs/hubspot-sync-queue.ts— dedicated queue for HubSpot Integration with rate-limiting to respect API limits - Rendition backfill:
backend/src/lib/jobs/rendition-backfill.ts— one-time migration job for generating thumbnails for existing Files
Process Supervision
Workers run as separate processes managed by supervisord.conf in the renewa-one/ root. The supervisor ensures workers restart on failure and provides log aggregation.
Redis Connection
Jobs use Upstash Redis in cloud environments and local ioredis in development. Connection is configured through the DI container’s infrastructure layer.
See Also
- HubSpot Integration — CRM sync queue details
- Notifications — email/SMS job processing
- Files — rendition generation
- PDF Templates — PDF conversion jobs
- Docker Setup — worker container configuration
- Dependency Injection — service reuse in processors
- Service Layer Pattern — business logic shared with routes