Command Query Responsibility Segregation design pattern

learn more… | top users | synonyms

1
vote
1answer
63 views

Where should you validate the state of “other” aggregates?

Scenario: A customer places an order, then, after receiving the product, provides feedback on the order process. Assume the following aggregate roots: Customer Order Feedback Here are the ...
0
votes
0answers
48 views

Did we have an evolution from detached entities to CQRS?

Let's say you have a software solution that has a data layer that accesses a SQL server. It can do this either directly and also over a HTTP connection. In both cases Datasets are used. Now when ...
3
votes
1answer
46 views

Rewrite Events in EventStore

I'm thinking about whats the correct pattern to handle this case in CQRS / Event Sourcing: I created events to calculate a balance and system goes into production. By accident, this implementation ...
1
vote
1answer
32 views

In a CQRS/ES application, can projections be dependant?

With event sourcing, you can project an event to create query-optimised read models. This I understand. What I'm unsure about is whether these read models can depend on each other? I'm considering ...
5
votes
1answer
2k views

CQRS + Event Sourcing: (is it correct that) Commands are generally communicated point-to-point, while Domain Events are communicated through pub/sub?

I'm basically trying to wrap my head around the concept of CQRS and related concepts. Although CQRS doesn't necessarily incorporate Messaging and Event Sourcing it seems to be a good combination (as ...
0
votes
2answers
69 views

Reading the result of your command with the Command Pattern

I am currently looking into developing a new system utilizing hexagonal architecture and the commandpattern facilitated by a commandbus like tactician (it's a PHP system). Now I really like the idea ...
12
votes
4answers
5k views

DDD, Saga & Event-sourcing: Can a Compensate Action simply be a delete on the event store?

I realize the above question probably raises a few 'what??'s, but let me try to explain : I'm trying to wrap my head on a couple of related concepts, basically the Saga-pattern ( http://www....
4
votes
3answers
96 views

In CQRS/ES, can a command create another command?

In CQRS/ES, a command is sent from the client to the server and routed to the appropriate command handler. That command handler loads an aggregate from its repository, and calls some method on it, and ...
5
votes
3answers
118 views

How do you deal with legacy data integrity issues when rewriting software?

I am working on a project which is a rewrite of an existing legacy software. The legacy software primarily consists of CRUD operations (create, read, update, delete) on an SQL database. Despite the ...
0
votes
1answer
80 views

Should I use cqrs + es to build a slot machine app?

for me the app that I'm building, a very simple slot machine app where there is which users can deposit money to buy credits, and use those credits to play teh slot machine, and withdrawl their ...
6
votes
1answer
446 views

DDD CQRS - per-query and per-command authorization

Summary Should authorization in CQRS/DDD be implemented per-command/query or not? I am developing for the first time an online application using more or less strictly the DDD CQRS pattern. I bumped ...
1
vote
3answers
222 views

Is it considered good practice to always have methods return a value?

Sorry for the terrible title but hopefully these snippets will give you the gist. Method 1: class Person: def __init__(self, name): self.name = name def set_name(self, new_name): ...
2
votes
2answers
346 views

Version hash to solve Event Sourcing problems

The basic examples I have seen about Event Sourcing do not deal with out of order events, clock offsets in different systems and late events from system partitions. I am wondering if more polished ...
1
vote
2answers
497 views

Event sourcing, replaying and versioning

I am designing a system that uses Event Sourcing, CQRS and microservices. I am lead to understand this isn't an uncommon pattern. A key feature of the service needs to be the ability to rehydrate/...
27
votes
6answers
3k views

Better to have 2 methods with clear meaning, or just 1 dual use method?

To simplify the interface, is it better to just not have the getBalance() method? Passing 0 to the charge(float c); will give the same result: public class Client { private float bal; float ...
1
vote
3answers
110 views

Event Sourcing and cross-context aggregate

I had this idea of different write models being used in different bounded contexts, but both being the same aggregate instance (the same events). For example consider a User aggregate that is used ...
7
votes
4answers
518 views

Where should an object in CQRS+ES be fully initialized: in the constructor, or when applying the first event?

There appears to be widespread agreement in the OOP community that the class constructor should not leave an object partly or even fully uninitialized. What do I mean by "initialization"? Roughly ...
4
votes
2answers
474 views

Domain Driven Design - designing Aggregate Roots

Imagine you're designing an application for organizing Workshops. Workshop itself is quite complicated - it acts as a state machine with multiple possible states and transitions between them. We're ...
3
votes
2answers
3k views

Domain Services vs. Factories vs. Aggregate Roots

After dealing with DDD for months now, I'm still confused about the general purposes of domain services, factories and aggregate roots in relation to each other, e.g. where they overlap in their ...
7
votes
3answers
530 views

Microservices and isolated data storage models [duplicate]

I have been looking at Microservices for a while now. The concept is not new but it's communicated in a lightweight manner. So, I am very excited about this. However, there is a question that I am ...
2
votes
3answers
311 views

When using DDD and CRQS, should be exactly one event per command?

I am looking for a way to design a ddd application with convention over configuration. Say an aggregate "Client" has a command defined "FillProfile". It will logically raise an event "ProfileFilled". ...
-1
votes
2answers
60 views

“Separate Query from Modifier” and return values [closed]

I've heard it said that you should keep query and modifier functions separate from one another, and I agree with the sentiment. When trying to apply it, I often run into two issues/questions: What, ...
5
votes
2answers
211 views

CQRS and validations

I'm starting to introduce myself in CQRS concepts, but I get stucked with the following situation: Supouse you have an entity that must have an unique name. In order to verify that, prior to create ...
2
votes
2answers
143 views

Deleting subtrees in hierarchical agreggates

I am working on a file-system-like application where I use CQRS/event-sourcing to handle the state of folders and files (creating, moving, renaming, etc). Each node (folder or file) is represented by ...
2
votes
3answers
338 views

CQRS and DDD terminology

Since CQRS and DDD do not imply one another I was curious what terms belong to DDD and what terms belong to CQRS. Because the two concepts are so much used together in the literature I usually mix ...
2
votes
1answer
163 views

Can “REST without PUT” support optimistic locking using ETags?

Rest without PUT models immutable, append-only (event-sourced) state changes by favouring POST-ing new reified change resources over PUT-ing updates to original. Example: making and then changing a ...
2
votes
1answer
58 views

How to update an event log in case of new events

In CQRS with Event Sourcing, if the current domain lacks a feature so it has to be extended with a new command (sent from a new saga) and an event (sent by the aggregate handler of that command), how ...
2
votes
0answers
118 views

CQRS “private” command

In CQRS, if a saga (or more precisely a process manager according to the CQRS Journey book) sends out a new command to change aggregates how can I ensure that this command is not possible to send from ...
5
votes
1answer
232 views

How to query Aggregate Root to react to event from other AR

I want to create a little GPS tracking program. Simplified: Users can create Tracks. To make things scale Track and User are two separate AR's. Track contains an AuthorUser which it refers to by ...
3
votes
2answers
593 views

Managing non-domain application behaviour in CQRS

Here's a scenario. I am building QueueUnderflow, a community-edited Q&A site for people who haven't yet grasped the basics of data structures. My users don't like it when people edit their posts ...
1
vote
1answer
80 views

Loading Aggregate Root from Database with Validations

Here is a similar question Where to validate domain model rules that depend on database content? I am asking this new question because I have more descriptions and I don't want to change the ...
4
votes
2answers
1k views

Distributed application using RabbitMQ

I am on my way to create an application with 4 bounded context using CQRS & event sourcing. In order to make these bounded context talk to each other I was planning on using Rabbit MQ. My ...
2
votes
1answer
379 views

Event Sourcing , sagas, bus and eventual consistency

I am currently learning about Event Sourcing via the book Microsoft .NET - Architecting Applications for the Enterprise. Event sourcing is, in my own words, an architectural pattern of storing "events"...
1
vote
1answer
438 views

How shall I project CQRS command and query services through WCF

I got directed to this site for more conceptual questions. Here is my issue: Im designing an application that uses CQRS to expose functionality to higher levels in the stack. This looks like below (...
5
votes
2answers
487 views

CQRS: How to restore read model

It's very interesting how to restore read model in system based on CQRS. In regular mode system processes commands, creates domain events and posts them to message bus. Then another part of system (...
2
votes
1answer
120 views

Event sourcing – finding aggegate by different property than ID

Is there any mechanism or best practise for finding aggregates by different property than aggregate ID? I'll try to explain my question on example. There is Cart aggregate (event-sourced) and ...
0
votes
4answers
408 views

CQRS: Query write model

Context: User wants to edit entity details, say user name. Assuming the fact that the Read Model is eventually consistent with the Write Model is it conceptually wrong to query write model in order ...
5
votes
1answer
2k views

How Add/Create* commands should be handled in CQRS + Event Sourcing architecture

I want to implement my first application using CQRS pattern along with Event Sourcing. I am wondering how creation of aggregate roots should be handled properly. Let's say someone sends CreateItem ...
2
votes
2answers
633 views

How does a search functionality fit in DDD with CQRS?

In Vaughn Vernon's book Implementing domain driven design and the accompanying sample application I found that he implemented a CQRS approach to the iddd_collaboration bounded context. He presents ...
6
votes
2answers
357 views

Is it necessary anymore to extract logic from API controllers?

I've been working in MVC web frameworks since its they started getting popular with RoR and ASP.NET MVC. I have always been careful to never put "business logic" on my controllers since that couples ...
8
votes
2answers
11k views

Can SQL Server and Mongo be used together?

We have a large news-oriented site that has high web traffic. The architecture is your often seen DB - Repo Layer - Services Layer - Asp.Net MVC. The problem that we've been seeing is around read ...
1
vote
2answers
72 views

What layer generates commands for dependent services?

Our business works with truck drivers making pickups/deliveries of containers. The location of containers needs to be tracked. The drivers use mobile devices to generate a "DriverReport" (a log of ...
1
vote
1answer
76 views

How to model parallel processes (in a Bounded Context) with the same data store?

The situation. Let's say a background process puts stuff into data containers. It runs all the time, observes system events, and populates the data accordingly. The user may launch a control panel ...
14
votes
5answers
6k views

Is it bad practice for services to share a database in SOA?

I have recently been reading Hohpe and Woolf's Enterprise Integration Patterns, some of Thomas Erl's books on SOA and watching various videos and podcasts by Udi Dahan et al. on CQRS and Event Driven ...
2
votes
1answer
350 views

What is eventual consistency?

I've heard people talking about "eventual consistency" (for example in this question and this answer). What is "eventual consistency"? How does it compare to "transactional consistency"? When does it ...
2
votes
1answer
116 views

Encapsulate one business story/use case in one class?

I don't like classes like *Service, with bunch of business methods - aka anemic model. I was thinking, instead, to have a class per use case. This was inspired (if not the same) from CQRS. Even if we ...
3
votes
2answers
699 views

Where to put format validation in a CQRS “stylish” domain model?

It feels right to put format validation inside the domain objects (VOs or entities) because it is the natural place for high cohesion and the domain knows best what every domain description/attribute/...
2
votes
0answers
270 views

Entities (DDD) when using CQRS on Akka

When using Akka, CQRS style, is still there a place for Entities? Or does everything now go to Aggregates, implemented as Actors + Value Objects. I notice that most entities are written as mutable ...
1
vote
2answers
1k views

Designing a social network with CQRS, graph databases and relational databases in mind

I have done quite an amount of research on the topic so far, but i couldn't come up with a conclusion to make up my mind. I am designing a social network and during my research i stumbled upon graph ...
3
votes
2answers
3k views

REST Service and CQRS

I am struggling with architecture on a new project. I am using the following patterns/technology. CQRS - anything going in goes through a command REST - using WebAPI MVC - asp.net mvc Angular - ...