-
Notifications
You must be signed in to change notification settings - Fork 21
Projections
Its.Cqrs has support for building read models (or projections) from the events in your event store. This is done using one or more event handler classes ("projectors"). The projector will be passed one event at a time and has the responsibility of updating a projection (for example in a database or cache) in response. Projectors are typically used both to replay historical events and to keep projections up to date as new events are written. Depending on your scenario, this process can be either:
-
synchronous when the events are first written, by subscribing projectors to an
IEventBus
where events are published after being successfully committed to the event store by anIEventSourcedRepository<T>
, or -
asynchronous by subscribing projectors to a
ReadModelCatchup<T>
, which polls the event store and calls the projectors with incoming events as they appear.
Its.Cqrs has a number of classes for creating projectors:
-
You can implement
IUpdateProjectionWhen<T>
. Using this interface, multiple handlers for different event types can be declared on the same class. -
You can call
Projector.Create<T>
and create a handler for a single event type to create an anonymous instance ofIUpdateProjectionWhen<T>
. -
You can call
Projector.CreateFor<T>
to create an anonymous duck-typed projector, which is not constrained to handle events of typeIEvent
. This can be useful in projects that create projections but have no need to reference your domain. (Projector.Create<T>
andProjector.CreateFor<T>
may be merged in the future #18.) -
You can call
Projector.CreateDynamic
to create an anonymous projector that receives events as dynamic objects.
-
Reservation service: unique values and pools of reserved values
-
Conventions, type discovery, and dependency injection