Outbox.Ticker (Outbox v0.1.0-beta.1)

Copy Markdown View Source

Periodically runs Outbox.Dispatcher.run/0 in a supervised Task.

Oban's free Cron plugin is minute-granularity, but the bus needs sub-minute dispatch latency. This GenServer ticks every interval_ms (default 5000) and spawns a Task on Outbox.TaskSupervisor to do the dispatch work.

Why a Task (not an Oban job):

  • No per-tick Oban telemetry log noise.
  • The dispatcher is internal infrastructure — Oban's retry/DLQ machinery doesn't add value here. The next tick (5s later) is the retry.
  • Task crashes are isolated from the Ticker (supervised).

Concurrent overlap is safe: FOR UPDATE SKIP LOCKED in the dispatcher ensures two simultaneous runs never claim the same event.

Disabled in test (set enabled: false); tests drive dispatch explicitly via Outbox.Testing.with_sync_dispatch/1.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)