Grokking Microservices Design Patterns
0% completed
CQRS Pattern: An Example
Let's consider a simple application that manages user profiles. In this application, you can create a new user (command), update their email (command), and view user details (query).
1. Command Model (Write Model)
- Command Class: Defines an action to be performed. For instance,
CreateUserCommandwith fields likeuserId,name, andemail. - Command Handler: Processes the commands. It would take
CreateUserCommand, perform business logic, and persist the changes. - Domain Model: Represents the state of the data (e.g., a
Userclass). 4
.....
.....
.....
Like the course? Get enrolled and start learning!
Sila Setthakan-anan
· a year ago
SimpleBusQuery's constructor will receive only 1 parameter.
But in the Putting it All Together section show us init SimpleBusQuery's instance with 2 arguments.
Ihor Luhovyi
· 3 months ago
In Event Sourcing, I understand that domain events are stored in an Event Store — but why do we store events instead of just saving the current state like in a regular database? And does that mean read operations (like checking a balance) also get stored as events, or only write operations that change state?