@ssdev-toolkit/nestjs-cron
v1.0.0
Published
Scheduled jobs (Quartz-style expressions) that enqueue work through a queue port. Persistence of job definitions is a host port (`CRON_JOB_STORE_PORT`).
Readme
@ssdev-toolkit/nestjs-cron
Scheduled jobs (Quartz-style expressions) that enqueue work through a queue port. Persistence of job definitions is a host port (CRON_JOB_STORE_PORT).
Install
npm install @ssdev-toolkit/nestjs-core @ssdev-toolkit/nestjs-cronTypical host wiring: JSON-store or Prisma for ICronJobStorePort, and { provide: CRON_JOB_QUEUE_PORT, useClass: QueueCronJobAdapter } after QueueModule.forRootAsync().
What it does
CronModule.forRoot/forRootAsync(export alias ofCron2Module)CronExpression/normalizeToQuartz- Payload schema
CronJobPayloadSchemafor JSON-store documents - Errors:
InvalidCronExpressionError,CronJobNotFoundError
Usage
CronModule.forRootAsync({
imports: [IntegrationsModule],
useFactory: () => ({ /* poll interval, timezone, … */ }),
});The host must register CRON_JOB_STORE_PORT and CRON_JOB_QUEUE_PORT or startup validation fails.
Build (this repo)
npm run build -w @ssdev-toolkit/nestjs-cronOverview: root README.
