Problem
Once we
implement database-per-service, there is a requirement to query, which requires
joint data from multiple services — it's not possible. Then, how do we
implement queries in microservice architecture?
Solution
CQRS suggests splitting the application into two parts — the command side and the query side.
- The command side handles the
Create, Update, and Delete requests.
- The query side handles the query
part by using the materialized views.
The
event sourcing pattern is generally used along with it to create events for any
data change. Materialized views are kept updated by subscribing to the stream
of events.
No comments:
Post a Comment