coldbox-scheduled-taskslisted
Install: claude install-skill ColdBox/skills
# Scheduled Tasks
## When to Use This Skill
Use this skill when you need to run background tasks on a schedule — recurring jobs, one-off warm-up tasks, heartbeats, cache cleanup, data sync, or any server-side automation.
## Language Mode Reference
Examples use **BoxLang** / CFML script syntax (both supported identically for scheduler code).
## Core Concepts
- **Global Scheduler** — `config/Scheduler.cfc` with a `configure()` method; auto-discovered by ColdBox
- **Module Scheduler** — each module can have its own `Scheduler.cfc` inside the module root
- **WireBox ID** — the global scheduler is available as `appScheduler@coldbox`
- **Task DSL** — fluent API on `ColdBoxScheduledTask` object returned by `task( name )`
- **Built on AsyncManager** — backed by Java `ScheduledExecutorService`
## File Location & Structure
```
config/
Scheduler.cfc ← Global app scheduler
modules_app/
myModule/
Scheduler.cfc ← Module-level scheduler
```
### Minimal Scheduler
```javascript
// config/Scheduler.cfc
component {
function configure() {
task( "Clear Old Sessions" )
.call( () => getInstance( "SessionService" ).purgeExpired() )
.everyDayAt( "02:00" );
}
}
```
## Full Scheduler Template
```javascript
component {
/**
* Configure global scheduler settings and register tasks.
* Available config methods:
* setTimezone( "America/Chicago" )
* setExecutor( asyncManager.newScheduledExecutor("myPool", 50) )