Chapter 7: Implementing Queries

The best view comes after the hardest climb.

– Anonymous

In the section Command Query Responsibility Segregation (CQRS) from Chapter 3, Understanding the Domain, we described how DDD and CQRS complement each other and how the query side (read models) can be used to create one or more representations of the underlying data. In this chapter, we will dive deeper into how we can construct read-optimized representations of the data by listening to domain events. We will also look at persistence options for these read models.

When working with query models, we construct models by listening to events as they happen. We will examine how to deal with the following situations:

  • New requirements evolving over a period of ...

Get Domain-Driven Design with Java - A Practitioner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.