Class EddyqModule
Implements
- OnApplicationBootstrap
- BeforeApplicationShutdown
- OnApplicationShutdown
Index
Constructors
constructor
- new EddyqModule(
options: EddyqModuleOptions,
queue: EddyqInstance,
explorer: EddyqExplorer,
aggregator: EddyqQueueAggregator,
): EddyqModuleParameters
- options: EddyqModuleOptions
- queue: EddyqInstance
- explorer: EddyqExplorer
- aggregator: EddyqQueueAggregator
Returns EddyqModule
Methods
beforeApplicationShutdown
Parameters
Optionalsignal: string
Returns Promise<void>
onApplicationBootstrap
Returns Promise<void>
onApplicationShutdown
Returns Promise<void>
StaticforRoot
Parameters
- options: EddyqModuleOptions
Returns DynamicModule
StaticforRootAsync
Parameters
- options: EddyqModuleAsyncOptions
Returns DynamicModule
StaticregisterQueue
Register a queue's per-queue config + producer handle. Call from any feature module —
EddyqModule.forRoot(orforRootAsync) must be imported once at the app root for the connection + worker runtime.Each call adds two providers to DI:
- the QueueRegistration value (under a namespaced token), so the aggregator can collect it at bootstrap.
- a QueueHandle (under
getQueueToken(name)), injectable via@InjectQueue(name).
The module exports the queue-handle token so consumers in this feature module can inject it without re-importing.
Parameters
- registration: QueueRegistration
Returns DynamicModule
NestJS module for eddyq.
Provides an
Eddyqclient as a global DI token, scans providers for@Processor()+@JobHandler(kind)annotations at bootstrap, registers each handler withqueue.work(), and starts the worker runtime.Shutdown is split across two hooks so in-flight handlers can finish cleanly even when they depend on resources owned by other modules (Drizzle, ioredis, etc.):
beforeApplicationShutdown— drain the worker runtime. User modules have not yet torn down their pools, so handler code can still complete DB writes, cache reads, etc.onModuleDestroy(per user module) — user-owned pools close here.onApplicationShutdown— release the eddyq Postgres pool. Runs last; nothing else in the app needs it by this point.