Stack Exchange Network

Stack Exchange network consists of 175 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
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [cqrs]

Command Query Responsibility Segregation design pattern

0
votes
1answer
33 views

Can a query handler (not repository) access a web service?

Say I have the following class, which maps to a database table: public class Person { public Guid Id {get; set; } public string Name {get; set; } public DateTime DateOfBirth {get; set; } public ...
0
votes
1answer
27 views

How to approach to ES/CQRS in serverless cloud?

Let's say I want to use CosmosDB for Event Store, where have single collection for all events. Currently it is not horizontally partitioned, but it is a possibility for future. Now, I need to ...
0
votes
0answers
51 views

EventSourcing / CQRS Implementation with ASP.NET Core WebApi and Azure Cosmos DB

I was looking for an easy implementation of the Event Sourcing and CQRS Pattern in ASP.NET Core using Azure Cosmos DB as Event Store. As I couldn't find anything appropriate I decided to write a ...
-2
votes
0answers
19 views

Integration between components using commands

I have an app that contain 2 modules. Each module is in separate zone. Communication between those components is done using service bus. Let's say that I have a command: Create Product. It is sent ...
1
vote
2answers
60 views

CQRS and Transactional Event Sourcing, problem while recreating Read DB

I'll first explain the context of my problem. The backend of my current project is using DDD, CQRS and Event Sourcing as a stack (the read DB being a MongoDB, my write DB being an event store). At ...
1
vote
1answer
60 views

CQRS - Business Logic in Query Side

I am working on handling authorization for an application. I need some way for a command handler to ask the Authorization bounded context "Is this user allowed to perform this action?". User account ...
-1
votes
0answers
50 views

PUT API conventions in a CQRS Event sources system

I am having trouble deciding between building a single PUT API (if you pass an entity id that exists in the system, it replaces that entity) vs two CREATE(does not allow you to replace an entity with ...
0
votes
0answers
27 views

How many exchanges when using scatter gather and CQRS?

I am trying to learn more about CQRS and enterprise integration in my spare time. I have created an application, which uses CQRS and the Scatter Gather Pattern. There are two web APIs for the CQRS ...
2
votes
0answers
31 views

Can the read api receive events that the write api does not receive or raise?

Say I have a read API and a write API: MyApp.Write.api MyApp.Read.api Both API's handle integration events from other apis/microservices. Say I had certain integration events that only need to be ...
1
vote
1answer
147 views

CQRS command that needs to work with multiple aggregate roots

I have have a business process that receives an order request which also includes full customer information. In the cases where the external customer ID from that order request is not found in our DB,...
0
votes
1answer
78 views

Passing Keys instead of Messages

Recently I stood up a Redis server and tested the idea of storing application 'states' that only existed in our application and were never stored in our database. Don't know if we will ultimately do ...
0
votes
1answer
54 views

Circuit Breaker + Retry - Repository or Application Layer

I currently have a Web App using ASP.NET Core 2.2, Domain Driven Design, Clean Architecture, and CQRS. I'm using MongoDB as persistence. I have developed a Repository pattern to abstract the MongoDB ...
0
votes
2answers
163 views

DDD - Modifying multiple entities under multiple aggregate roots

In our domain we have a concept of billable activities that get logged by a user. The modeling is pretty straightforward -- the User is an aggregate root, with the Activities being a collection under ...
0
votes
1answer
152 views

CQRS with an Event Log and without Event Sourcing

I am trying to understand the difference between an event log and event store in the context of event sourcing. A really nice explanation I found is that an event store is the single source of truth ...
1
vote
1answer
86 views

is Event sourcing using Database CDC considered good architecture?

When we talk about sourcing events , we have have a simple dual write architecture where we can write to database and we can write the events to a queue like Kafka . Other downstream system can read ...
3
votes
1answer
69 views

DDD - Aggregate that changes “owner” mid-process

We're evaluating CQRS/ES for a high-volume subsystem in our app in order to take advantage of distributed systems and ensure uptime. This is my team's first time implementing this architecture, and I'...
0
votes
1answer
111 views

What is the full value of the CQS principle in a system that doesn't implement the CQRS pattern?

I'm having trouble grasping the value proposition of the "command" half of the CQS principle in a system that doesn't implement command query responsibility segregation. The CQS principle states that ...
1
vote
3answers
144 views

Domain Events, CQRS, and dependency resolution in handlers

Currently: ASP.NET Core 2.2. I've been doing quite an extensive research in this topic (Domain Driven Design used together with Clean Architecture): DDD: Where to place domain event handlers? And I'...
0
votes
1answer
129 views

Can the write database have different fields to the read database?

I am trying to learn CQRS in my spare time. Say I have a class like this: public class Person { private Guid Id {get; set;} private Guid Name {get; set;} private List<Order> orders; //...
0
votes
2answers
139 views

Anemic Domain Model, CQRS, command bus

Considering this pattern is used to support CQRS message bus, examples are buslane Python or MessageBus PHP It uses commands to change the domain model, and publishes domain events This looks great ...
2
votes
1answer
132 views

How to better scale reads in a website: to CQRS or not to CQRS?

The company i'm working for it's rewriting a legacy web application and we are evaluating the better architecture to get the job done. The business domain is quite simple: there are few entities, ...
0
votes
2answers
444 views

CQRS using queries or read services only?

Discussing about a CQRS implementation with my team we don’t agree on a point concerning the Query side. On the Commad side we have actual command clases; a CommandDispatcher that schedules commands, ...
2
votes
2answers
595 views

Should CQRS Command perform a Query?

I have Customer, Order, and Product Aggregate Roots... When the order is created, it takes in a Customer and a List<Sales.Items>. It looks something like: public class Order { public static ...
1
vote
2answers
774 views

Clean architecture, CQRS, and authentication?

I'm working on implementing my first clean architecture and CQRS application, I've stumbled across a bit of logic that's leaving me a bit stumped. I'm working on integrating authorization and ...
0
votes
1answer
43 views

CQRS across bounded contexts to generate reports with possible business logic

Where do you draw the line for how much logic can go in your read models? For example, we have 2 BCs: Inventory and Sales. We need to generate reports regarding inventory levels on specific dates: ...
1
vote
3answers
206 views

How to validate command before executing on aggregate when validation needs to query data?

In a DDD designed application with CQRS principle how do we handle the case when a command needs to be validated before it is executed on an aggregate and the validation needs to query the existing ...
0
votes
0answers
37 views

Choice between PUT and a separate request for each change for CRUD-based UI

I'm making an HTTP API for ASP.NET Core Identity. Basically what I want is a remote version of this: https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.usermanager-1?view=...
2
votes
1answer
70 views

Should I store an event stream or just state for a frequently changing entity?

I am building a CQRS-based application with Kafka Streams. For most entities in my application this entails event sourcing: capturing state mutations as events and transforming them into state which ...
2
votes
1answer
325 views

How to model domain events so that the denormalizers can fill highly denormalized read models

I have been working with a software strongly relying on the event sourcing and CQRS patterns for a few time and I'm trying to figure out how to properly model the domain events in relation to the ...
2
votes
2answers
97 views

Denormalising a CRUD and ES bounded context for rich queries

As a small snapshot of my product, I have 2 bounded contexts, one which is a rich domain with defined events and invariants, operating on files implemented as CQRS/ES, and the other a CRUD store of ...
0
votes
1answer
58 views

Domain events or services to achieve domain model consistency?

Recently began implementing domain events in my domain layer which really allows me to decouple the application from the domain. Eventually, I would like to get a full-scale CQRS w/Event Sourcing ...
1
vote
2answers
184 views

get aggregate id based on its data in it

I have an aggregate root called SizeRangeAggregate which holds the range of size of clothing piece dimension and price for that range. I created an post rest API which create new SizeRangeAggregate. ...
0
votes
0answers
12 views

Is there any value in passivation (setReceiveTimeout) for persistent actors without read store?

I am not experienced in Akka, so my assumptions may be completely wrong. As far as I understand, Aggregate Root may manage its entities either just keeping their state internally and restoring it at ...
0
votes
2answers
549 views

In what layer are the DTOs stored with CQRS?

The Domain has the Domain Models. The Infrastructure layer has Commands and Queries, forming CQRS. Commands return Domain Models, and Queries return DTOs. In any API, the DTOs are stored in the ...
1
vote
2answers
500 views

Putting it all together - DDD, CQRS, Web API

I need some expert guidance. I'm trying to learn the concepts as well as implement them, and it's possible I might be over-engineering some. But that's OK, because I am wanting to learn and gain ...
2
votes
0answers
78 views

UI syncing in case of bulk operation api

In a CQRS system, the convention that we follow is we render the detail view of an aggregate(i.e getById) using the write model and views containing multiple aggregates(like a dashboard) using read ...
3
votes
4answers
605 views

Command handling fail feedback with CQRS

We are developing some context using CQRS approach. We have ended up with command handlers emitting events. It seems to be not a good idea to us. However we can't find any alternative approach. We ...
2
votes
2answers
136 views

Event Sourcing CQRS and request events ending at Requested

In ES/CQRS, do/can we treat requests as events? Consider the following flow A guest visited some url and posted data to create a new account. Here is one way to implement it 1- Invoke ...
0
votes
1answer
664 views

DTO vs. read model

If I understand the concept of read models correctly, then it's just a simple query to return a use case specific data set. But a DTO seems to have the same purpose, but in a more complex way (...
1
vote
3answers
202 views

Event Sourcing - Reconstituting Aggregate from Wrong Event Stream

I am working on a project to help learn DDD and am trying to do CQRS and Event Sourcing. Code is in C#. For this example, lets say I have 2 aggregates, Customer and Product. My aggregate repository ...
0
votes
2answers
297 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
820 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
2answers
99 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
291 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 ...
6
votes
1answer
1k 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 (...
3
votes
3answers
850 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 ...
3
votes
3answers
524 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
52 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
74 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
155 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 ...