Process-scoped correlation id manager.
This provides an idiomatic Elixir alternative to AsyncLocalStorage-based context in other clients by using the process dictionary.
Summary
Functions
Clears the current correlation id and replaces it with a new generated id.
Gets the current correlation id for the calling process.
Sets the current correlation id for the calling process.
Functions
@spec clear() :: Chronicle.Correlation.CorrelationId.t()
Clears the current correlation id and replaces it with a new generated id.
@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.
@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.