# `Chronicle.EventSources.EventSource`
[🔗](https://github.com/Cratis/Chronicle.Elixir/blob/main/lib/chronicle/event_sources/event_source.ex#L4)

Declares an event source definition.

An event source gives appends a stable name, optional streams and default
concurrency dimensions. Routing belongs to the append, not to event types: the
same event type can be appended through different event sources.

    defmodule MyApp.AccountEventSource do
      use Chronicle.EventSources.EventSource,
        name: "Account",
        description: "A bank account",
        concurrency: [:event_source_id]

      stream "Transactions",
        description: "Money movements",
        concurrency: [:event_source_id, :event_stream_id]
    end

Definitions are discovered like event types and registered with the event store
at startup. Append through one with the `:event_source` and `:event_stream`
options of `Chronicle.append/3` and friends. Without a definition appends behave
exactly as before.

Omit `:name` to use the module's last segment without a trailing `EventSource`.

# `stream`
*macro* 

Declares a named stream of the event source.

Options: `:description` and `:concurrency` (dimensions, see
`Chronicle.EventSources.ConcurrencyDimensions`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
