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

The routing of an append that has been resolved from an event source definition.

Resolution errors are returned as tuples so appends never send a partial request:

  * `{:unknown_event_source, reference}`
  * `{:event_stream_does_not_belong_to_event_source, source, stream}`
  * `{:event_routing_contradicts_event_source, source, dimension, expected, actual}`

# `t`

```elixir
@type t() :: %Chronicle.EventSources.Routing{
  definition: Chronicle.EventSources.EventSourceDefinition.t(),
  stream: Chronicle.EventSources.EventStream.t() | nil
}
```

# `dimensions`

```elixir
@spec dimensions(t()) :: Chronicle.EventSources.ConcurrencyDimensions.t()
```

The concurrency dimensions that apply to the append.

# `event_source`

```elixir
@spec event_source(t()) :: String.t()
```

The event source name recorded as the `EventSource` metadata of the event.

# `resolve`

```elixir
@spec resolve(
  [module()],
  module() | String.t(),
  String.t() | nil,
  String.t() | nil,
  String.t() | nil
) ::
  {:ok, t()} | {:error, term()}
```

Resolves an event source (module or name) and optional stream name against the
registered event source modules.

Explicit source type / stream type values that contradict the definition are
rejected; empty, `"Default"` (source type) and `"All"` (stream type) values
mean "not specified".

# `source_type`

```elixir
@spec source_type(t()) :: String.t()
```

The event source type to write on the event.

# `stream_type`

```elixir
@spec stream_type(t()) :: String.t()
```

The event stream type to write on the event.

---

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