Kantoor. Karta. BodyFetcher
(Kantoor v1.0.0)
Fetches message bodies for notify-only pushes and completes the pending record.
enqueue/2 is fire-and-forget. Each job runs in a supervised task: raw fetch
from Karta, then Kantoor.Ingest.complete/2. Failures retry with exponential
backoff (base * 2^(attempt-1), capped) up to max_attempts, then the record
stays :pending_fetch (it can be re-enqueued, e.g. by a later duplicate push).
Progress is reported with telemetry events [:kantoor, :karta, :fetch, :done],
:retry and :failed, metadata %{message_id: id, attempt: n}; tests attach
to them instead of sleeping.
Config (config :kantoor, Kantoor.Karta.BodyFetcher): :max_attempts (8),
:backoff_ms (5_000), :max_backoff_ms (900_000).
Summary
Functions
Delay before attempt attempt + 1 (pure, exposed for tests).
Returns a specification to start this module under a supervisor.
Queues a body fetch for a :pending_fetch message.
Functions
@spec backoff(pos_integer()) :: non_neg_integer()
Delay before attempt attempt + 1 (pure, exposed for tests).
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec enqueue(Kantoor.Mailboxes.Message.t(), GenServer.server()) :: :ok
Queues a body fetch for a :pending_fetch message.