Home » Selecting a CQRS Architecture That Works for You | by Matt Bentley | Oct, 2023

Selecting a CQRS Architecture That Works for You | by Matt Bentley | Oct, 2023

by Icecream
0 comment

A comparability between the several types of CQRS structure and the way to decide on the proper one in your drawback

Image by writer

Command Query Responsibility Segregation (CQRS) is an unlimited ocean of deep matters inside The World of Software Architecture. It is commonly stigmatised with large complexity, and lots of engineers are reluctant to dip their toes within the water.

Some nice articles discuss by means of complicated, ultimately constant, distributed CQRS system architectures that may deal with huge scale. If you’re simply getting began with CQRS, then this could be a little daunting. In actuality, there are additionally a lot less complicated choices that work nicely for many issues.

CQRS splits information entry into Commands and Queries.

  • Commands: Write information – Create/Update/Delete
  • Queries: Read information
CQRS Components

Each Command and Query class has a corresponding Handler class. Generally, Commands and Queries are dispatched to their Handler utilizing a synchronous in-process Mediator. Sometimes asynchronous strategies, similar to a Message Bus, are used for dealing with Commands when there are high-scale necessities.

Splitting Write and Read operations means we will optimise both sides independently. This would possibly imply totally different Write and Read fashions. It would possibly even imply utterly totally different databases. That alternative is determined by the non-functional necessities of your app.

Let’s discuss by means of among the choices and once they can be utilized.

This is the best flavour of CQRS, the place our Commands and Queries use the identical Model/Entity courses. For most small-to-medium-sized apps, that is usually effective!

You may also like

Leave a Comment