Summary
In this chapter, we supplemented our event sourced entity model with a separate read model, following the CQRS pattern. We implemented our separate read models by leveraging Akka's Persistence Query feature to listen to event streams from our entities and project those events into Elasticsearch, which serves as our read model data store. Following this approach gives us rich query capabilities against the current state of our entities while still preserving the event sourced nature of those entities for the write model. We also leveraged Persistence Query to finalize the back-and-forth interaction between the inventory and sales modules when allocating an inventory to a new sales order.
The code we created in this chapter to listen to the ...
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