Maestro.Aggregate.ProjectionHandler behaviour (Maestro v1.0.0)

View Source

ProjectionHandlers are used to manage alternate representations of an aggregate.

This defines a minimal behaviour for use within the aggregate command/event lifecycle. For projections that should be updated immediately iff the relevant events are committed, the relevant ProjectionHandler should by included in the list of :projections on the aggregate root.

Summary

Callbacks

Projections registered with an aggregate root are invoked for every event, so they should ignore unrelated events explicitly.

Types

event()

@type event() :: Maestro.Types.Event.t()

repo()

@type repo() :: module() | nil

Callbacks

project(repo, event)

@callback project(repo(), event()) :: value :: any()

Projections registered with an aggregate root are invoked for every event, so they should ignore unrelated events explicitly.