AW-13: Migrate from SqliteJobQueue to BullMQJobQueue and Remove SQLite Queue#
Summary#
Replace the SqliteJobQueue provider in QueueModule with BullMQJobQueue (created by AW-11), remove the SQLite queue implementation and JobEntity, delete the JOB_QUEUE_DRIVER config flag if present, and update all tests. This completes the AW-10 initiative by making BullMQ the sole job queue backend.
Files#
| File | Action | Description |
|---|---|---|
src/queue/queue.module.ts | modify | Swap SqliteJobQueue → BullMQJobQueue; remove TypeOrmModule.forFeature([JobEntity]) and EventEmitterModule imports |
src/queue/index.ts | modify | Replace SqliteJobQueue export with BullMQJobQueue |
src/queue/sqlite-job-queue.ts | delete | Remove SQLite queue implementation |
src/queue/sqlite-job-queue.spec.ts | delete | Remove SQLite queue unit tests |
src/database/entities/job.entity.ts | delete | Remove JobEntity (jobs table) |
src/database/entities/index.ts | modify | Remove JobEntity export |
src/database/database.module.ts | modify | Remove JobEntity from entities array and forFeature |
src/database/database.module.spec.ts | modify | Remove JobEntity references and job creation test |
src/operational/operational.module.ts | modify | Remove TypeOrmModule.forFeature([JobEntity]) |
src/operational/operational.controller.ts | modify | Remove jobRepo injection and job-related endpoints (or adapt to query BullMQ) |
src/operational/operational.controller.spec.ts | modify | Remove JobEntity mock and job endpoint tests |
src/control-api/control-api.module.ts | modify | Remove JobEntity from forFeature |
src/control-api/controllers/jobs.controller.ts | modify | Replace JobEntity repo queries with BullMQ queue introspection |
test/job-queue.e2e-spec.ts | modify | Rewrite E2E tests against BullMQJobQueue |
.env.example | modify | Remove JOB_QUEUE_DRIVER if present; ensure Redis vars are documented |
Steps#
- Remove
SqliteJobQueueand wireBullMQJobQueue— Deletesqlite-job-queue.tsand its spec. Updatequeue.module.tsto import and provideBullMQJobQueue(from AW-11) as theJOB_QUEUEtoken. Updateindex.tsexports. - Remove
JobEntityfrom database layer — Deletejob.entity.ts. Remove fromentities/index.ts,database.module.tsentities array, anddatabase.module.spec.ts. - Update consumers that import
JobEntity— RemoveJobEntityfromoperational.module.ts,control-api.module.ts, and all spec files that include it in TypeORM setup (event.service.spec.ts,internal-adapter.service.spec.ts,metrics.service.spec.ts,tasks.controller.spec.ts). - Adapt jobs controller and operational endpoints — Replace
JobEntityrepo queries injobs.controller.tsandoperational.controller.tswith BullMQ queue introspection APIs (list jobs, retry, cancel via BullMQQueueclass). Update corresponding specs. - Update E2E tests — Rewrite
test/job-queue.e2e-spec.tsto test againstBullMQJobQueuewith a real Redis connection (useREDIS_DBisolation per CLAUDE.md conventions). - Clean up config — Remove
JOB_QUEUE_DRIVERfrom config schema and.env.exampleif present. EnsureREDIS_HOST,REDIS_PORT,REDIS_DBare documented. - Verify — Run
npm run lint,npm run test,npm run build.
Verification#
npm run testpasses with noSqliteJobQueueorJobEntityreferences remainingnpm run buildsucceeds;npm run lintreports zero warningsgrep -r "SqliteJobQueue\|JOB_QUEUE_DRIVER" src/returns zero results
Risks#
- AW-11 dependency —
BullMQJobQueuemust exist and implementJobQueueinterface before this work starts. AW-11 (#457) and AW-12 (#458) are prerequisites. - Jobs controller redesign —
jobs.controller.tscurrently queriesJobEntityvia TypeORM. Replacing with BullMQ introspection changes the data shape; consumers ofGET /api/jobsmay need client updates.
Open Questions#
- Should the
GET /api/jobsendpoint maintain the same response shape (with adapter mapping), or is a breaking change acceptable?