Building Your First Projection
The bank account ledger example is one of the easiest to build and understand in event sourcing, so let’s start there. In this exercise, you’ll build a projection for a bank account balance. In more formal terms, you’ll build a projector that takes data from events in the event log and stores that data in a read model projection, which can then be queried by consumers.
A projector is a piece of code responsible for producing read model data for consumption by one or more parties. For this sample, the projector is AccountBalance and the projection is a piece of data containing the most up-to-date balance for a given account. As with aggregates, projections have keys that allow you to differentiate one from another. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access