Plugin family for the cron-trigger scheduler that fires workflows at their scheduled times. Only one implementation today (Quartz), but the SPI is in place so alternatives can be added.
This directory is a Maven parent POM.
dolphinscheduler-scheduler-api— theSchedulerApiinterface (start,insertOrUpdateScheduleTask,deleteScheduleTask,close) + related DTOs.dolphinscheduler-scheduler-quartz— Quartz-based implementation.QuartzScheduler(SchedulerApi impl),QuartzSchedulerAutoConfiguration,QuartzSchedulerDataSourceAutoConfiguration,QuartzTriggerBuilder.dolphinscheduler-scheduler-all— uber module consumed by master.
- User defines a schedule in the UI → API persists a row.
- Master's leader starts the scheduler;
SchedulerApi.insertOrUpdateScheduleTaskregisters the Quartz job. - When Quartz fires, it inserts a
t_ds_commandrow (WorkflowScheduler → CommandService). Master's command consumer picks it up and runs the workflow.
- Only the master leader runs the scheduler. Non-leader masters hold
SchedulerApi.close()-like quiet state. Electing a new leader must re-register all schedules. - Separate Quartz datasource:
QuartzSchedulerDataSourceAutoConfigurationconfigures its own datasource pointing at the same DB as DolphinScheduler but with Quartz's own tables (QRTZ_*). Upgrades must run Quartz's own DDL as well as DolphinScheduler's. - Job key scheme:
jobKeyconcatenatesprojectId_scheduleId. Renaming this scheme breaks in-flight scheduled tasks — avoid. - Cron parsing happens in two places:
dolphinscheduler-service/cronusescron-utilsfor display (next fire time in UI); Quartz internally uses Quartz cron syntax for firing. The two are mostly compatible but DOW conventions differ slightly — always validate with both. - Do not couple to Quartz types outside this module. Callers must depend on
SchedulerApi, never onorg.quartz.Schedulerdirectly.
A new scheduler implementation would: (1) create a sibling sub-module; (2) implement SchedulerApi; (3) register via Spring Boot spring.factories / AutoConfiguration.imports; (4) add itself to scheduler-all.
Inside -quartz/src/test/java.
dolphinscheduler-master— consumesscheduler-all.dolphinscheduler-service— usesCronServicefor next-fire-time display (independent of this module's runtime).