Skip to main content

Quickstart

import { QTask, registerTask } from '@quik/scheduler';

class CleanupTask extends QTask {
public constructor() {
super('cleanup', '0 0 * * *');
}

public async run() {
// cleanup work
}
}

registerTask(CleanupTask);

Notes

  • QTask's constructor takes a task name and a cron expression (or an IQExecutionPlan object) as its first argument, with an optional execution plan as the second when a name is provided.
  • registerTask(...tasks) registers task classes on the active IQScheduleExecutor. It silently does nothing if the scheduler feature has not been initialized.
  • The scheduler feature is only initialized when the bootstrap startScheduler flag is set — registering @quik/scheduler in bootstrap alone does not start it. See Configuration.
  • @quik/scheduler depends on @quik/entity.