Registers event types with a Chronicle event store.
Called automatically by Chronicle.Registration.Coordinator during startup.
You can also call it directly to register event types at runtime.
Example
{:ok, channel} = Chronicle.Connections.Connection.channel(:my_conn)
:ok =
Chronicle.Events.EventTypes.register(
channel,
"my-store",
[MyApp.Events.AccountOpened],
[MyApp.Migrations.AccountOpenedV2Migration]
)
Summary
Functions
Registers event type modules and their migrations with Chronicle.
Validates a set of event type and migration modules without raising.
Like validate/2, but raises the exception instead of returning it.
Functions
Registers event type modules and their migrations with Chronicle.
Each event type module must use Chronicle.Events.EventType. Chronicle groups all
known generations of the same event type into a single registration, includes
schemas for each known generation, and attaches any registered migrations.
Returns :ok on success or {:error, reason} on failure.
@spec validate([module()], [module()]) :: :ok | {:error, Exception.t()}
Validates a set of event type and migration modules without raising.
Returns {:error, exception} with a Chronicle.Events.MultipleEventTypesWithSameIdFound
struct when several modules represent the same generation of the same event type id, or a
Chronicle.Events.MultipleMigratorsForSameEventTypeGeneration struct when more than one
migrator bridges the same pair of generations. Returns :ok otherwise.
The client calls this once at startup, before the first connection attempt: a failure is
logged and startup continues, unless the strict_validation: true client option is set, in
which case validate!/2 raises it.
Like validate/2, but raises the exception instead of returning it.