Command Query Responsibility Segregation

Command Query Responsibility Segregation (CQRS) is often used alongside event sourcing. CQRS consists of two parts:

  • The writing part receives state-update commands and stores them in an underlying event store, but does not return an entity state.
  • The reading part does not change the state and returns it for a requested query type. State representations for distinct queries are stored in views, which are recalculated asynchronously after update events are received as commands.

The way in which the CQRS pattern works is as follows:

Diagram 7.10 A CQRS implementation for the Order service. The write part stores update commands, and the read part asynchronously calculates views for expected queries

The CQRS pattern allows software systems to process huge volumes of data in a streaming manner and, at the same time, it makes it possible to respond quickly to various queries regarding the current system state.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.205.136