Command-Query Responsibility Segregation is an architectural pattern, which focuses on separating the Write functionality from the Read functionality. It should only be used in the design of some of the components and not become the base of the entire system. If the system is complex enough, using CQRS as the basis for everything may become too complex and some advantages may be lost.
Suppose you have the below normal Microservice which handles both command and query requests:
The above microservice can be split into 2 microservice:
What are the frameworks used to handle distributed transactions ?
There are many frameworks used to handle transaction across multiple services, like – Eventuate, Axon etc. Both of these frameworks use CQRS (Command-Query Responsibility Segregation) design pattern. Axon framework uses CQRS and DDD (Domain Driven Design) both.