Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Command Query Responsibility Segregation design pattern

0
votes
2answers
108 views

CQRS, Where exactly is business logic that coordinates between aggregates?

Where exactly to put business logic. While everyone said put it in the aggregate. Yes, But what if business logic need datas of multiples aggregate? Or if business logic need to update multiple ...
1
vote
1answer
67 views

Serverless event-sourced architecture using AWS offerings

This is my first post on the Software Engineering Stack Exchange so let me know if something is wrong with it. I'm looking into the serverless offerings of Amazon to try to figure out if that is the ...
0
votes
1answer
31 views

Would it be OK if I mention actor in the command/query name when I use CQS pattern

I'm applying Clean Architecture + DDD (maybe) in my project (web Application + REST API). The good thing I learned from the Clean Architecture is using "Interactors" to show business use cases in my ...
1
vote
2answers
77 views

Can command handlers be separated from aggregate roots in CQRS

On one hand, the invariants should be protected (To make invalid states impossible early and preferably at compile time rather than run time), and on the other hand, passing domain knowledge out of ...
2
votes
1answer
100 views

CQRS-Event Sourcing: how to process events in the expected order inside the read model

I'm looking for some insights about how to handle the read model in a CQRS Event Sourcing application, in order to do the best to ensure data consistency. The missing point is how to be sure (...
0
votes
2answers
148 views

CQRS+Event Sourcing as Top Level Architecture: Anti-Pattern

I have been study DDD along with CQRS and Event Sourcing. I recently listened to a talk Greg Young gave a couple years ago where he said that CQRS and Event Sourcing are not a top level architecture ...
2
votes
2answers
277 views

Why “Event sourcing an entire system is a big mistake and considered an anti-pattern”?

Why event sourcing an entire system is a big mistake and considered an anti-pattern? And what situation it's consider an anti-pattern? Reference 1 Reference 2 Updated Question : Still don't ...
0
votes
1answer
45 views

How should “preparation” and “usage” of the same data be separated in a DDD application, if at all?

In most domains, there is an app that "prepares" data, and another app that "serves" the prepared data. The data, however, is from the same Core Domain, which causes some confusion in modeling. Some ...
0
votes
1answer
49 views

CQRS, Should I have bidirectional aggregate reference?

Suppose we have domain Character and Player. Character owned by Player. Player PlayerID : GUID OwnedCharacterIDs : Guid[] Character CharacterID : GUID OwnerPlayerID : GUID While my ...
0
votes
1answer
77 views

CQRS, What reasons cause read model update delay? How to prevent user from taking inconsistence data?

I am considering CQRS for building a realtime game server (not gameplay but the economy). For some reasons. Scaling, Event logging, Model changing. However in realtime game when player upgrade, for ...
-1
votes
1answer
127 views

CQRS, How to query aggregate root using others fields rather than GUID (ID)?

There are many CQRS frameworks and event store libraries. All of them use GUID as aggregate root's ID. Those event store only let me query only by GUID. I realise that there are many times in last ...
2
votes
4answers
144 views

Does CQRS need to be fire and forget, If we need to read guarantee after command?

I'm in researching phase of CQRS+ES. Never done in real world yet. But very soon. However what I saw in StackOverflow and projects, CQRS seems to be fire and forget. So what if there is a chain ...
6
votes
2answers
402 views

Zero argument constructors and Always Valid entities

I have done a lot of reading recently about Always Valid domain entities. I have come to believe that in order to ensure the entities are always valid I need to: 1) Remove primitive obsession and ...
0
votes
2answers
147 views

How to store Sagas with Event Sourcing

I have a long running process that collects together the IDs of Aggregates that have been edited/changed, so that a later command can 'publish' them to a legacy model. I understand that I should use ...
3
votes
4answers
229 views

Too many unecessary events

I'm new to eventsourced apps and since the beginning I'm facing an issue that I'm unsure how to resolve. I work in ecommerce and I always try to convey meaningful events to my aggregates like ...
2
votes
1answer
124 views

CQRS and microservices: passing information from one service to another

We're building two microservices that use CQRS and Event Sourcing: an Order Service and an Inventory Service. When an order is made, the inventory of that item must be decreased by the amount ordered. ...
2
votes
1answer
105 views

High scale architecture using Event Sourcing and Eventual Consistency

I want to share with you and know what your opinion/improvements are regarding a solution I was tasked with a technical interview I faced. The exercise: You need to create an API which will indicate ...
0
votes
1answer
22 views

Evaluate http reqres vs websockets for geolocation based broadcasts

My use case is that I have a real-time broadcast app where users get feed items based on a geolocation, i.e. a user will receive posts that were broadcasted from within a user-defined radius where (s)...
0
votes
2answers
136 views

Designing events in an event-driven (event sourced) architecture and managing duplication

I have been creating a POC for a part of our system but I'm finding some trouble communicating some of the ideas behind it. This takes ideas from Event Sourcing and Event Driven Architecture but ...
2
votes
1answer
172 views

Can CQRS pattern exist without mediator pattern?

Can CQRS pattern exist and/or work without mediator pattern? I mean there are always commands and these commands have to be dispatched somehow to the handlers that perform some logic on them. Does ...
1
vote
1answer
59 views

Passing Meta info from Command through Aggregate to Event

I have a CQRS system in development that passes the Command to a CommandHandler, which gets an Aggregate from a Repository, and calls a method with the properties of the Command (converted to ...
2
votes
1answer
57 views

CQRS with sub methods that are used in more than one place

I have a situation where some commands are using some common methods. These were originally developed in one command and are now helpful to other commands, they can be static and are self contained. ...
3
votes
1answer
173 views

eventsource/CQRS - Replaying projections of an aggregate in order

I have a eventsourced project and I want to replay the following two events, in order: ProductCreatedEvent PriceChangedEvent I've been told that projections should be asynchronous, so when replaying,...
1
vote
1answer
208 views

How are CQRS write models initially populated?

I have a system that interacts with a REST API as the data source. This system is based on DDD and all of my current models are CRUD models. There is one model that the REST API is only able to query ...
3
votes
2answers
217 views

CQRS async query from command handler

In a CQRS/async microservices context, I have a command handler e.g. SendOrderConfirmationEmailCommandHandler implemented in a communications service. This depends on information from the orders ...
-2
votes
1answer
101 views

Modeling sprint and ticket in DDD

I'm trying to learn DDD/CQRS in a hobby project. And have no prior experience. In this project I use MongoDb as a read db and EventStore as a write db. I'm building a simple 'Sprint board' ...
0
votes
3answers
409 views

DDD: Event handlers and aggregates in functional programming

When implementing a DDD driven system (based on event sourcing) using a functional programming language (Clojure), should one separate event handler functions from aggregate functions? In my naive ...
3
votes
3answers
118 views

With event sourcing, how to get the response of a call that is a side-effect?

Let's say my user requests my ES/CQRS system to open a support ticket: The controller sends an ask-support command, this command checks if the user has enough credit to do that, then emits an asked-...
1
vote
2answers
119 views

Recovering the state of the Write Service in an Event Sourced system

Quick question, I've been digging into CQRS and Event Sourcing and there's one thing that I have not been able to find info on, what happens when your Write Service crashes and you need to start it ...
6
votes
2answers
152 views

CQRS in Collaborative Domains

I am reading this article about CQRS, and when it comes to decide where to use it, the following didn’t really get to my mind: Collaborative domains where multiple operations are performed in ...
1
vote
3answers
487 views

In CQRS, is it okay to call external services from Sagas/Process Manager?

In my domain where I am applying CQRS, there are some external service calls in order to some validation. I am a bit puzzled about where to put these calls. I am considering to put these calls to my ...
2
votes
1answer
200 views

CQRS, microservices and delta replication

We have a micro-service that has a Domain Model and have an analytical service for the domain which has its own Query Model. The domain model and the query model are stored in separate persistencies. ...
1
vote
1answer
280 views

Should I use NoSQL or RDBMS for materialized view in this CQRS / ES implementation?

I am going to try to build a implementation of CQRS and ES for large scale application (1M users) authentication API. Below is my initial architecture draft (Ignore Azure related stuff). I am going to ...
2
votes
2answers
508 views

CQRS, Event Sourcing and (near) Real Time Reporting

I am working with a small team that is developing a CQRS/ES "semi-microservice architecture. We are pretty far along, but running into some interesting challenges with our projections and further ...
2
votes
1answer
381 views

Using Event Sourced Aggregate Roots with the Specification Pattern

I have a Aggregate Roots that use the event sourcing technique of being built from a series of events in a Repository. This is all great for when I just need to manage change of state etc, but when I ...
1
vote
2answers
449 views

CQRS - What is the Command Dispatcher?

To learn CQRS I'm putting together a really simple command/command handler implementation. In a lot of examples, I'm seeing the concept of a "Command Dispatcher". I'm not seeing a lot of literature on ...
10
votes
3answers
965 views

Rehydrating Aggregates from a “snapshots” projection rather than the Event Store

So I've been flirting with Event Sourcing and CQRS for a while now, though I've never had the opportunity to apply the patterns on a real project. I understand the benefits of separating your read ...
1
vote
2answers
405 views

Can one Aggregate Root have multiple subtypes

I have a concept that I am struggling to design in a DDD CQRS manner, and I hope to find some insight. In the old days (before I knew DDD) I would have used simple inheritance, and that's how my mind ...
2
votes
0answers
205 views

Can Event Sourcing and an API Management platform leverage each other?

I'm evaluating the use of Kafka to implement Event Sourcing in a microservices environment that already makes use of an API Management platform. I was wondering if it is common and/or considered a ...
-2
votes
2answers
440 views

Are CQRS and Hexagonal Architecture incompatible?

I am beginning a project and I was wondering If I can use CQRS and Hexagonal architecture in the same project, or in fact they are incompatible. I read about CQRS and some people agree that it is not ...
0
votes
2answers
103 views

Dealing with Image data redundancy in a NoSQL table

Say I have a database structure like this: CREATE table Customer (id identity, name varchar(30), dateofbirth datetime, Photo varbinary, primary key (id)) CREATE table Order (id int, Date datetime, ...
0
votes
1answer
146 views

DDD - Same ID/Primary Key, different Aggragate Root class per Bounded Context

I am working on understanding DDD and want to see if this idea is sound, if it is common practice, and if there are any pitfalls or unforeseen complications. I want to effectively have one "entity" ...
0
votes
1answer
105 views

ES / CQRS concurrency

Trying to understand concurrency with CQRS, I came across that question: https://softwareengineering.stackexchange.com/a/349575/286881 But there is something I don't understand when it is said that: ...
0
votes
1answer
203 views

Can you rebuild/create new read models without Event Sourcing?

According to Vernon Vaughn's - Implementing Domain Driven design: ...Events are used to rebuild the state of the Aggregate by replaying them in the same order in which they occurred. The premise ...
1
vote
2answers
749 views

Handling aggregate root with deep object hierarchy

What is the correct way to apply commands to objects deep within the model hierarchy? Given the following model: public class Picture : AggregateRoot { private string title; private List<...
7
votes
2answers
1k views

How do I deal with side effects in Event Sourcing?

Let's assume that we want to implement a small security subsystem for a financial application that warns the users via email if a strange pattern is detected. For this example, the pattern will ...
0
votes
3answers
962 views

DDD, CQRS, ES - is it worth it or it just waste of time?

I’m trying to apply DDD, CQRS (saga, fire and forget principle, etc), ES in my current project, with help of akka. Never done it before in real projects (just played a litle bit), sounds great in ...
7
votes
5answers
213 views

How do I define a single generic method to apply events that are subtypes of a base class?

(Note: I'm not sure how to frame the question properly, so please feel free to edit it or comment about how I can improve it.) I guess this question, while covering a fairly wide scope, is pretty ...
5
votes
3answers
648 views

Should internal entities in an aggregate respond to domain events directly?

I am fairly new to implementing CQRS and Event Sourcing, while applying rules of domain driven design. Let's say I have an Order aggregate and inside it is a list of OrderLine entities. I'm using this ...
9
votes
3answers
342 views

How to handle side effects in CRQS when replaying events?

It is said that in CQRS it is easy to fix a bug, you just redeploy and then replay the events. But, what if one of the events should cause an external system not in your control to "ship an item" to ...