Skip to content

[BE-08] Implement BullMQ job queue for async operations - installed but never configured #266

Description

@Leothosine

Problem

@nestjs/bull and bull are in package.json but BullModule is never configured. Long-running operations - Cloudinary image uploads, email notifications, and Stellar blockchain transactions - currently block the HTTP request thread. A slow Cloudinary upload or Stellar network delay causes the entire request to time out.

Proposed Solution

  1. Configure BullModule.forRootAsync() in AppModule with Redis connection from ConfigService
  2. Create a QueueModule with processors for:
    • image-upload queue: moves Cloudinary uploads out of the request handler
    • notification queue: placeholder for future email/push notifications
    • blockchain queue: placeholder for Stellar transaction submission
  3. POST /api/cloudinary/upload enqueues a job and returns { jobId } immediately
  4. Add GET /api/admin/queue/stats (admin-only) returning { waiting, active, completed, failed, delayed }

Acceptance Criteria

  • POST /api/cloudinary/upload returns within 200ms regardless of Cloudinary latency
  • Job status can be polled via GET /api/admin/queue/stats
  • Failed jobs after 3 retries update the related record status to FAILED
  • GET /api/admin/queue/stats returns 403 for non-admin users
  • BullMQ uses Redis (not in-memory) so jobs survive server restart

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions