cqrs

How to adapt CQRS to projects? [closed]

心已入冬 提交于 2019-12-04 07:47:10
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . I came across a new term named CQRS (Command Query Responsibility Segregation) which states that the conceptual model should be split into command model and query model as a typical CRUD model in which the command and query happens in the same model. The article has all

CQRS: Read model built on demand?

[亡魂溺海] 提交于 2019-12-04 05:18:36
As I understand CQRS advocates separating read models from domain models and having a particular read model for every necessary domain model projection. From usage point, how the read model is stored and retrieved should be transparent - you issue a query and get a read model without caring about how it is made. Many examples and articles use separate tables for storing read models and re-generating them by response to domain model changes. I do not really like this approach because of the following reasons: Not all possible read models will be needed often; Requirement changes might

Accessing a web service from CQRS

本小妞迷上赌 提交于 2019-12-04 04:41:08
Supposed I have a CQRS-based system and my domain needs some data from an external web service to make its decisions. How do I model this correctly? I can think of two options: The command handler runs the domain logic and the domain itself calls out to the web service. Once it gets a response, it attaches the appropriate events to the current aggregate and stores them. The domain basically "waits" for the web service to return. The command handler runs the domain logic and the domain immediately emits a domain-internal more data needed event. A process manager reacts on this, talks to the web

CQRS Validation & uniqueness

痴心易碎 提交于 2019-12-04 04:08:13
In my CQRS architecture, I'd like to validate that when I send a InsertSettingCommand (setting is a key/value object), I want to check that the key doesn't already exist in my database. If I understand CQRS & validation well, it says that the validation should be performed in client side only when it's about verifying some formatting stuffs like checking that email respects some syntax or that customer's name is not empty. But in my case, I need to query my database to see if it exists, but I don't know if it's correct to query my read store in client-side ? Or should I call my read store in

CQRS Read Model Design when Event Sourcing with a Parent-Child-GrandChild… relationship

◇◆丶佛笑我妖孽 提交于 2019-12-04 03:08:22
I'm in the process of writing my first CQRS application, let's say my system dispatches the following commands: CreateContingent (Id, Name) CreateTeam (Id, Name) AssignTeamToContingent (TeamId, ContingentId) CreateParticipant (Id, Name) AssignParticipantToTeam (ParticipantId, TeamId) Currently, these result in identical events, just worded in the past tense (ContingentCreated, TeamCreated, etc) but they contain the same properties. (I'm not so sure that is correct and is one of my questions) My issue lies with the read models. I have a Contingents read model, that subscribes to

CQRS - When to send confirmation message?

瘦欲@ 提交于 2019-12-04 00:24:31
Example: Business rules states that the customer should get a confirmation message (email or similar) when an order has been placed. Lets say that a NewOrderRegisteredEvent is dispatched from the domain and is picked up by an event listener that sends of the confirmation message. When that is done some other event handler throws an exception or something else goes wrong and the unit of work is rolled back. We've now sent the user a confirmation message for something that was rolled back. What is the "cqrs" way of solving problems like this where you want to do something after a unit of work

How to approach the Q in CQRS when doing Event Sourcing with Akka?

杀马特。学长 韩版系。学妹 提交于 2019-12-03 21:19:53
问题 Is there a good way of doing CQRS when combined with Event Sourcing? One way I thought about was doing this in the Command handler (of a Persistent Actor) as soon as the Command was turned into an Event and persisted to the event log (these Events represent the Write model), I would send the event using the event bus to interested subscribing query actors so they can update their Query model. The other way I was thinking (provided the journal supports it) is to use persistence queries (via

In CQRS, should my read side return DTOs or ViewModels?

。_饼干妹妹 提交于 2019-12-03 18:30:09
问题 I'm having a debate with my coworkers in the design of the read side of a CQRS application. Option 1: The application read side of my CQRS application returns DTOs, e.g: public interface IOrderReadService { public OrderDto Load(int id); } public class SomeController { public ActionResult SomeAction(int id) { var dto = ObjectFactory.GetInstance<IOrderReadService>().Load(id); var viewModel = Mapper.Map<OrderDto, SomeViewModel>(); return View(viewModel); } } public class SomeOtherController {

Reading data from database on Write Side in CQRS

寵の児 提交于 2019-12-03 16:37:07
Background : Diagrams explaining CQRS usually will have clear separation of read and write paths and one-way data flow, like in this example (source : Demystified CQRS ) : Question : I would like to clarify, If a Command execution in back-end requires some data from the database, should a "write side" have some read capabilities from write database? or it should completely rely on "read side" for any reads? or perhaps command should contain all the required data supplied by caller to be fulfilled? should a "write side" have some read capabilities from write database? Probably -- the most

Eventual consistency across aggregate roots in the same bounded context using a process manager aka saga

北城余情 提交于 2019-12-03 13:55:58
Suppose you've got two aggregates in your bounded context which have some constraints amongst each other. Using DDD these inter aggregate constraints can't be enforced in the same transaction i.e. the aggregate boundaries are transactional boundaries. Would you consider using what in the Microsoft CQRS journey is called a "process manager" to coordinate two aggregates in the same bounded context or is a process manager only used to coordinate between two bounded contexts? What would the equivalent of a process manager that coordinates two or more aggregate roots within the same bounded context