Counterpoint.Supervisor (counterpoint v0.1.0)

Copy Markdown View Source

Top-level supervisor that wires up a Counterpoint instance.

Opens the DCB store, registers it in Counterpoint.Store, and starts the EventRegistry and automation infrastructure.

Options

  • :store (required) – keyword list with:
    • :name (required) – atom used to reference the store throughout the app.
    • :namespace (required) – DCB namespace string for this store.
    • :cluster_file – path to the FoundationDB cluster file (optional; uses the default cluster file when omitted).
  • :events – list of event modules to register for deserialization (default: []).
  • :automations – list of automation modules to start (default: []).

Example

Counterpoint.Supervisor.start_link(
  store: [name: :my_store, namespace: "my_app"],
  events: [MyApp.Events.OrderPlaced, MyApp.Events.OrderCancelled]
)

Add it to your application's supervision tree:

def start(_type, _args) do
  children = [
    {Counterpoint.Supervisor,
     store: [name: :my_store, namespace: "my_app"],
     events: [MyApp.Events.OrderPlaced]}
  ]
  Supervisor.start_link(children, strategy: :one_for_one)
end

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.