PhoenixMicro.Outbox.Relay (PhoenixMicro v1.0.0)

Copy Markdown View Source

GenServer that polls the outbox_messages table and relays undelivered messages to the configured transport.

Requires ecto_sql in your application's deps:

{:ecto_sql, "~> 3.11"}

Behaviour

Every :poll_interval_ms (default 1000ms) the relay:

  1. Selects up to :batch_size rows where relayed_at IS NULL and attempt <= max_attempts, ordered by inserted_at ASC.
  2. For each row, calls PhoenixMicro.publish_sync/3.
  3. On success: marks relayed_at = now().
  4. On failure: increments attempt, sets last_error. Once attempt > max_attempts, sets failed_at = now() and gives up.

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 \\ [])

@spec start_link(keyword()) :: GenServer.on_start()