Chronicle.EventTypes (chronicle v0.0.1)

Copy Markdown View Source

Registers event types with a Chronicle event store.

Called automatically by Chronicle.Projections.Registrar 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.EventTypes.register(channel, "my-store", [MyApp.Events.AccountOpened])

Summary

Functions

Registers a list of event type modules with Chronicle.

Functions

register(channel, event_store, event_type_modules)

@spec register(term(), String.t(), [module()]) :: :ok | {:error, term()}

Registers a list of event type modules with Chronicle.

Each module must use Chronicle.EventType. Generates a minimal JSON schema for each event type based on its struct fields.

Returns :ok on success or {:error, reason} on failure.