Create BullMQ module that shares the existing Valkey connection for job queue processing. Files Created: - apps/api/src/bullmq/bullmq.module.ts - Global module configuration - apps/api/src/bullmq/bullmq.service.ts - Queue management service - apps/api/src/bullmq/queues.ts - Queue name constants - apps/api/src/bullmq/index.ts - Barrel exports - apps/api/src/bullmq/bullmq.service.spec.ts - Unit tests Files Modified: - apps/api/src/app.module.ts - Import BullMqModule Queue Definitions: - mosaic-jobs (main queue) - mosaic-jobs-runner (read-only operations) - mosaic-jobs-weaver (write operations) - mosaic-jobs-inspector (validation operations) Implementation: - Reuses VALKEY_URL from environment (shared connection) - Follows existing Valkey module patterns - Includes health check methods - Proper lifecycle management (init/destroy) - Queue names use hyphens instead of colons (BullMQ requirement) Quality Gates: - Unit tests: 11 passing - TypeScript: No errors - ESLint: No violations - Build: Successful Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
24 lines
786 B
TypeScript
24 lines
786 B
TypeScript
import { Module, Global } from "@nestjs/common";
|
|
import { BullMqService } from "./bullmq.service";
|
|
|
|
/**
|
|
* BullMqModule - Job queue module using BullMQ with Valkey backend
|
|
*
|
|
* This module provides job queue functionality for the Mosaic Component Architecture.
|
|
* It creates and manages queues for different agent profiles:
|
|
* - mosaic-jobs (main queue)
|
|
* - mosaic-jobs-runner (read-only operations)
|
|
* - mosaic-jobs-weaver (write operations)
|
|
* - mosaic-jobs-inspector (validation operations)
|
|
*
|
|
* Shares the same Valkey connection used by ValkeyService (VALKEY_URL env var).
|
|
*
|
|
* Marked as @Global to allow injection across the application without explicit imports.
|
|
*/
|
|
@Global()
|
|
@Module({
|
|
providers: [BullMqService],
|
|
exports: [BullMqService],
|
|
})
|
|
export class BullMqModule {}
|