Current section

Files

Jump to
ash_oban usage-rules scheduled_actions.md
Raw

usage-rules/scheduled_actions.md

<!--
SPDX-FileCopyrightText: 2020 Zach Daniel
SPDX-License-Identifier: MIT
-->
# Scheduled Actions
Scheduled actions allow you to run periodic tasks according to a cron schedule:
```elixir
oban do
scheduled_actions do
schedule :daily_report, "0 8 * * *" do
action :generate_report
worker_module_name MyApp.Workers.DailyReport
end
end
end
```
## Scheduled Action Configuration Options
- `cron` - The schedule in crontab notation
- `action` - The generic or create action to call when the schedule is triggered
- `action_input` - Inputs to supply to the action when it is called
- `worker_module_name` - The module name for the generated worker
- `queue` - The queue to place the job in
- `max_attempts` - How many times to attempt the job (default: 1)