Starts what the framework needs at runtime, in the right order: the event bus, the handler subscriptions, the outbox poller and the dead-letter handler. Put it in your supervision tree after your repo:
children = [
MyApp.Repo,
{DDD.Supervisor, handlers: [MyApp.Handlers.SendWelcome, MyApp.Projections.ListSummary]}
]The repo is config :vicander, repo: MyApp.Repo (see DDD.Config).
Options
:handlers- the event handlers and projections (modules thatuse DDD.EventHandlerorDDD.Projection) to subscribe. They are subscribed before the poller starts, because an event with no subscribed handler counts as delivered. Default: none.:poller- options forDDD.Outbox.Poller(:interval_ms,:batch_size, ...), orfalsefor no poller and no dead-letter handler: what a test or a web-only node wants. Default:[], which polls every 500 ms in batches of 100.:retention-[older_than_days: 30](and optionally:every_ms) to prune published events from the outbox on a timer (DDD.Outbox.Retention). Default: never prune.:repo- another repo than the configured one:name- the supervisor's name (defaultDDD.Supervisor)
If the event bus restarts, it forgets its subscriptions, so the supervisor restarts everything after it (the subscriptions and the poller) too.
Summary
Functions
Returns a specification to start this module under a supervisor.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec start_link(keyword()) :: Supervisor.on_start()