# `Chronicle.Correlation.CorrelationIdManager`
[🔗](https://github.com/Cratis/Chronicle.Elixir/blob/main/lib/chronicle/correlation/correlation_id_manager.ex#L4)

Process-scoped correlation id manager.

This provides an idiomatic Elixir alternative to AsyncLocalStorage-based
context in other clients by using the process dictionary.

# `clear`

```elixir
@spec clear() :: Chronicle.Correlation.CorrelationId.t()
```

Clears the current correlation id and replaces it with a new generated id.

# `current`

```elixir
@spec current() :: Chronicle.Correlation.CorrelationId.t()
```

Gets the current correlation id for the calling process.

If no correlation id has been set, a new one is generated and returned.

# `set_current`

```elixir
@spec set_current(Chronicle.Correlation.CorrelationId.t() | String.t()) ::
  Chronicle.Correlation.CorrelationId.t()
```

Sets the current correlation id for the calling process.

Accepts either a `%Chronicle.Correlation.CorrelationId{}` or a raw string id.

---

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