Oban-based alarm scheduler.
This scheduler uses Oban's job processing infrastructure to deliver alarms. It's ideal for applications that already use Oban, as it leverages the existing setup and provides Oban's robust features (retries, observability, etc.).
Configuration
config :durable_object,
scheduler: DurableObject.Scheduler.Oban,
scheduler_opts: [oban_queue: :durable_object_alarms]You must also add the queue to your Oban configuration:
config :my_app, Oban,
repo: MyApp.Repo,
queues: [durable_object_alarms: 5]If your app uses a custom Oban instance name (not the default Oban), specify it:
scheduler_opts: [oban_instance: MyApp.Oban, oban_queue: :durable_object_alarms]How It Works
- Alarms are scheduled as Oban jobs with
schedule_in - When the job executes, it fires the alarm via
DurableObject.call/5 - Jobs use Oban's uniqueness to prevent duplicate alarms
- Failed alarms are retried according to Oban's retry policy (max 3 attempts)
Supervision
Unlike the polling scheduler, the Oban scheduler does not add any children to the supervision tree. Oban manages its own supervision and the worker jobs run within Oban's infrastructure.