Scheduler
Manages scheduled tasks with cron-like expressions and provides full job lifecycle control.
In-ports
set Object
— task definition with schedule configuration and optional data payload.
delete Object
— object containing job ID to remove from scheduler.
list <any>
— triggers emission of all scheduled jobs.
pause Object
— object containing job ID to pause execution.
resume Object
— object containing job ID to resume execution.
run Object
— object containing job ID to trigger immediate execution.
done Object
— object containing job ID to mark protected job as complete.
Out-ports
tick Object
— emits job status and data when tasks execute.
state Array
— emits current status of all scheduled jobs.
jobs Array
— emits list of all jobs when requested via list port.
errors Object
— emits error messages when task operations fail.
Overview
The Scheduler component provides comprehensive task scheduling capabilities using cron expressions. It allows you to create, manage, and monitor scheduled jobs with precise timing control.
To schedule a task, send a task definition object to the set port. The task definition includes a schedule (cron expression or object) and optional data payload. The component will create a scheduled job and emit status updates on the tick port when the job executes.
Use the pause and resume ports to control job execution without removing them from the scheduler. The run port allows immediate execution of scheduled jobs.
Jobs with protect: true
are protected jobs. The component will hold emitting new protected job triggers until the previous job is not complete. Use the done port to signal completion and allow the next execution. This prevents overlapping executions when a job takes longer than the scheduled interval.
Each instance of the component maintains a registry of scheduled jobs and provides real-time status updates including next run times, execution history, and remaining runs.
Settings
Output time format (format
)
Controls the format of timestamps in job status outputs.
- Required: Yes
- Values:
ISO
,UNIX
- Default:
ISO
Time zone (timezone
)
Specifies the timezone for scheduling operations. When empty, uses UTC.
- Required: No
- Default:
""
(UTC)
Examples
Basic Task Scheduling
Schedule a task to run every minute:
{
"id": "daily-backup",
"schedule": "0 * * * *",
"data": { "action": "backup", "target": "database" }
}
Advanced Scheduling
Schedule with start/stop times and maximum runs:
{
"id": "maintenance-window",
"schedule": {
"cron": "0 2 * * *",
"startAt": "2024-01-01T00:00:00Z",
"stopAt": "2024-12-31T23:59:59Z",
"maxRuns": 365
},
"protect": true,
"data": { "type": "maintenance" }
}