Implementing the Book read model
As usual, we'll take the plunge into our refactor with the inventory management module and the Book
entity. We want to build out both ViewBuilder
and View
for Book
so that we can build its read projection and be able to query against it again. We'll have to make some changes to our common code first so that we have a good framework to build our CQRS implementation on top of it. I'll start with describing those changes and then we can jump into the Book read-model implementation.
Supporting tagging in ProtobufDatamodelAdapter
When discussing the high-level approach we can use to build our read models, we decided that eventsByTag
was the Persistence Query feature to leverage. We wanted to tag our events with two String
tags—the entity type and the event type. We'll implement this tagging process in the ProtobufDatamodelAdapter
class that we created in Detaching the domain model from the data model section in Chapter 4, Making History with Event Sourcing. Before...