What runs Letterbox's work out of the request: fetching a message its provider told of, and giving each message to its mailbox. One runner does all of it, and another takes its place with no other change.
Letterbox.Runner.Oban- in Oban jobs, kept in the app's database: work that outlives a deploy, tried again with Oban's backoff. The default when the app runs Oban (an instance namedOban).Letterbox.Runner.Local- in a process of Letterbox's, tried again with backoff. The default otherwise. Work it had when the app stopped is not lost: each message's state is in its row, andLetterbox.resume/0(orLetterbox.Sweeper) gives it to the runner again.:inline- in the caller, at once: for tests (Letterbox.Test).- A module of the app's, of this behaviour.
Choosing it
config :letterbox, runner: Letterbox.Runner.Oban
config :letterbox, Letterbox.Runner.Oban, queue: :mail, name: MyApp.ObanWriting one
A runner keeps a job, a map that JSON holds (%{"work" => "process", "id" => "…"}), and runs it with Letterbox.Runner.run/1 until it gives
:ok, at most Letterbox.Config's :max_attempts times.
Summary
Callbacks
Keeps the job and runs it out of the caller: :ok once it is kept.
Functions
The runner used: the one given, else config :letterbox, :runner, else
Oban's when an instance named Oban runs, else Letterbox.Runner.Local.
Runs a job once: :ok, or {:error, reason} to be tried again. A job
for a message that is gone is :ok.
Types
Callbacks
Functions
The runner used: the one given, else config :letterbox, :runner, else
Oban's when an instance named Oban runs, else Letterbox.Runner.Local.
Runs a job once: :ok, or {:error, reason} to be tried again. A job
for a message that is gone is :ok.