Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Domain-Driven Design with Java - A Practitioner's Guide

You're reading from  Domain-Driven Design with Java - A Practitioner's Guide

Product type Book
Published in Aug 2022
Publisher Packt
ISBN-13 9781800560734
Pages 302 pages
Edition 1st Edition
Languages
Authors (2):
Premanand Chandrasekaran Premanand Chandrasekaran
Profile icon Premanand Chandrasekaran
Karthik Krishnan Karthik Krishnan
Profile icon Karthik Krishnan
View More author details

Table of Contents (17) Chapters

Preface 1. Part 1: Foundations
2. Chapter 1: The Rationale for Domain-Driven Design 3. Chapter 2: Where and How Does DDD Fit? 4. Part 2: Real-World DDD
5. Chapter 3: Understanding the Domain 6. Chapter 4: Domain Analysis and Modeling 7. Chapter 5: Implementing Domain Logic 8. Chapter 6: Implementing the User Interface – Task-Based 9. Chapter 7: Implementing Queries 10. Chapter 8: Implementing Long-Running Workflows 11. Chapter 9: Integrating with External Systems 12. Part 3: Evolution Patterns
13. Chapter 10: Beginning the Decomposition Journey 14. Chapter 11: Decomposing into Finer-Grained Components 15. Chapter 12: Beyond Functional Requirements 16. Other Books You May Enjoy

Implementing the query side

In Chapter 5, Implementing Domain Logic, we examined how to publish events when a command is successfully processed. Now, let’s look at how we can construct a query model by listening to these domain events. Logically, this will look something like the following diagram:

Figure 7.2 – The CQRS application – the query side

For a detailed explanation of how the command side is implemented, please refer to the Implementing the command side section in Chapter 5, Implementing Domain Logic.

The high-level sequence on the query side is described here:

  1. An event listening component listens to these domain events published on the event bus.
  2. It constructs a purpose-built query model to satisfy a specific query use case.
  3. This query model is persisted in a datastore optimized for read operations.
  4. This query model is then exposed in the form of an API.

Note how there can exist more than one query...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime}