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

Copy Markdown View Source

Read-only accessors for Outbox's application configuration.

All reads go through Application.get_env/2 at call time. No values are captured at compile time or process start, so config changes take effect immediately — important for tests that flip config between cases.

All configuration lives in a single keyword list under config :outbox, Outbox, [...].

Summary

Functions

Returns the Oban instance name to use for enqueueing subscriber jobs.

Returns the Phoenix.PubSub server name to broadcast dispatched events on. Returns nil if not configured — in which case the dispatcher skips the broadcast step.

Returns the PubSub topic. Defaults to "domain_events".

Returns the host's configured Ecto Repo module.

Returns the prune retention window in days. Defaults to 30.

Returns the list of registered subscriber modules. Defaults to [].

Functions

oban()

@spec oban() :: module()

Returns the Oban instance name to use for enqueueing subscriber jobs.

Defaults to Outbox.Oban (the library's own instance, started by Outbox.child_spec/1). Hosts that want to share their existing Oban instance set config :outbox, Outbox, oban: MyApp.Oban.

pubsub()

@spec pubsub() :: module() | nil

Returns the Phoenix.PubSub server name to broadcast dispatched events on. Returns nil if not configured — in which case the dispatcher skips the broadcast step.

pubsub_topic()

@spec pubsub_topic() :: String.t()

Returns the PubSub topic. Defaults to "domain_events".

repo()

@spec repo() :: module()

Returns the host's configured Ecto Repo module.

Raises a RuntimeError with a clear message if repo: is unset — silent nil would surface as a confusing UndefinedFunctionError deep inside Ecto.Adapter.lookup_meta/1.

retention_days()

@spec retention_days() :: pos_integer()

Returns the prune retention window in days. Defaults to 30.

subscribers()

@spec subscribers() :: [module()]

Returns the list of registered subscriber modules. Defaults to [].