Questions tagged [cqrs]
Command Query Responsibility Segregation design pattern
302
questions
2
votes
3
answers
275
views
Should we call a command inside another command in CQRS?
I know there are many posts on this question but none of them gives a clear answer or solution (atleast for my specific case)
Some of them are
In CQRS/ES, can a command create another command?
https://...
-2
votes
2
answers
179
views
When should I think about two databases (the first for reads, the second for writes) in CQRS?
I am not asking what are advantages of two databases - the first for reads and the second for writes. I am asking WHEN I should have two databases for reads and writes? Probably there is no simple ...
1
vote
2
answers
207
views
CQRS: Multiple entry points for a single command
I’m trying to follow the Clean Architecture and CQRS within an application that, let’s say, create a product.
To achieve this, the application has 3 adapters, one for reading a file, another for ...
0
votes
2
answers
128
views
cqrs/ddd - What is the point of having informational Data in the write model/aggregate?
I am wondering whether it makes sense to not store informational Data inside the write model database. By informational Data I mean data that is not directly used for any decision making in the write ...
0
votes
0
answers
154
views
DDD - How do scheduled tasks fit in CQRS/DDD
I am trying out CQRS, Event Sourcing and DDD in a project and I want to model a Reminder Service.
The context is as follows: Person A creates a Task for Person B and sets a Deadline for Person B to ...
1
vote
2
answers
86
views
CQRS how to display failed commands in the GUI
I am trying to use CQRS in my project and I was thinking how the GUI gets notified about failures in the GUI, when commands are fire and forget. My commandhandlers are not returning anything, but ...
0
votes
1
answer
66
views
Contextual Data on CQRS Requests
I use CQRS for most of my applications. My request objects contain the data needed by the Handler to perform the Request.
However, I've started to realize that some data points we have are required on ...
1
vote
2
answers
909
views
In DDD, how can repositories be optional?
I was reading the infrastructure persistence layer design documentation, and this quote has me confused:
This'll probably be my biggest feedback. I'm really not a fan of repositories, mainly because ...
1
vote
1
answer
639
views
How to handle aggregations of out-of-order events in an event stream?
I'm interested in integrating with an external system which uses webhooks to notify clients of events. The system is very similar to Stripe - the REST endpoints have rate limits to avoid undue polling ...
1
vote
3
answers
2k
views
Is CQRS CQRS without separate read and write data stores?
Is having a separate read only and write only data store a core part of CQRS, or does it still make sense in some scenarios to do CQRS with a single data store?
Asking because a coworker is using CQRS ...
1
vote
1
answer
145
views
Design considerations for data shared across multiple users: is Redis a good candidate?
I have an app that has an assets table like the following:
user_id
code
current_price
1
ALUP11
12.5
2
ALUP11
11.9
user_id and code are unique together and current_price is updated if the user ...
1
vote
2
answers
346
views
Using multiple databases in a bounded context
Sometimes we have to use multiple databases in one project
with the intentions of:
Denormalizing data or read models
Using the advantages of that database (technology)
There has been a lot of talk ...
2
votes
2
answers
485
views
Reduce Code Repetition for a Simple CQRS
We're currently exploring CQRS in our future applications. To give a bit of a background, we use a simple CRUD-style service before something like this.
Old Pattern:
Controller
Command/Service
Model
...
2
votes
3
answers
461
views
What should we do in face of a failing sub in pub-sub?
I'm working on a microservices application that is implemented from the ground up with MediatR em CQRS. We have a list of domain events that will be published via MediatR [simple pub-sub library that ...
1
vote
2
answers
466
views
CQRS and events order
I'm learning cqrs right now.
Problem
My concern is event ordering.
Assumption 1: user service is creating user and three events in order.
Each event was sent after each step was finished in write ...
1
vote
1
answer
2k
views
Best practices repository and service layer
I have read many articles about repository pattern and service layer but I have still some doubts in certain arguments:
Repository should return only aggregates and I should have repositories only ...
1
vote
1
answer
340
views
How do I make conditional queries within DDD logic
I have created a small ERP application and the architecture I chose included the Repository pattern and the anemic Domain model and Business logic layer.
I was reading Microsoft's guide about ...
0
votes
1
answer
117
views
How is model reconstructed with event sourcing in CQRS principle?
I'm trying to understand the CQRS design.
As far as I know now, every time a change to a model is saved, the (state) change is stored as a separate record.
When reading a model, the model is ...
1
vote
1
answer
261
views
Where should I fetch a product price to create an order in CQRS / DDD?
I want to save an order with order items with prices in my write database. But firstly I need to fetch products with their prices because I don't trust a user - he could pass a lower price, that's why ...
2
votes
1
answer
190
views
Moving from CRUD to CQRS: how to identify appropriate command-event relationships?
We have an existing CRUD-based system, but are hitting a number of pain points keeping the data organised for all the various views that are increasingly required of it. I'm assessing whether ...
3
votes
3
answers
1k
views
CQRS in a data heavy application involving a lot of CRUD
I've been developing a non-trivial personal application and I thought I'd use CQRS to learn it. The application is very data entry heavy, lots of entities and lots of forms. I find myself constantly ...
2
votes
1
answer
495
views
Internal/external commands in CQRS
I have several questions related to CQRS in eventually consistent systems with a need of resilient Command/Event processing.
Is it OK to have external/public synchronous Commands (triggered by API, e....
0
votes
1
answer
1k
views
Handling asynchronous domain events with multiple handlers & allowing them to fail independently
We're building a service using DDD, CQRS, & Hexagonal Architecture that allows the user to upload a CSV feed for which every row will be transformed and sent to a third party over HTTP.
We have ...
1
vote
2
answers
124
views
Applying Domain Driven Design to applications with both reading and writing heavy logics
We are planning a complete rewrite of a very complex project (10+ years, ~15 different application modules) and we would like to adhere to DDD and CQRS as much as possible but we are struggling to fit ...
2
votes
2
answers
435
views
Relaxing layering rules for queries?
In a typical DDD layered architecture (application, domain & infrastructure layers) you'd generally declare interfaces in the domain/application layers and implement infrastructure-dependent (e.g. ...
0
votes
0
answers
201
views
Avoiding reloading entities many times with EF Core and Mediatr
We have a largeish .NET Core project which uses Mediatr and EF Core. Many of the queries look something like:
public class GetSomeInformation : IRequest<string>
{
public int DocumentId { get;...
2
votes
1
answer
2k
views
How to scale transactional outbox pattern with document database?
I'm trying to understand CQRS, DDD by writing a small pet project which is somewhat similar to this great repo.
I've come across Transactional Outbox pattern and as imo it was correctly pointed out in ...
1
vote
1
answer
174
views
Tight coupling between micro services
I have got the following scenario, which I have been thinking what would be the "best" way to solve it.
Request comes from the FE, which changes the status of a delivery,
and that should ...
0
votes
0
answers
166
views
In CQRS, how does the event processor know how to populate the read-side database?
I'm currently playing around with a CQRS implementation and I'm having some trouble understanding the following concept:
Event Bus for publishing update events (required): Whenever the write
database ...
2
votes
3
answers
450
views
How to implement HATEOAS with CQRS?
Let's say I have a CQRS system where my write model contains the business rules. My read model is simply a DTO; it is a collection of properties and "dumb".
Now if you were to create a REST ...
1
vote
1
answer
2k
views
How to handle duplicate validation logic with CQRS pattern
I am implementing a CQRS pattern in ASP.NET Core with MediatR, and I am wondering what the general consensus is for handling duplicate validation logic for queries/commands which operate on the same ...
1
vote
0
answers
604
views
CQRS, DDD and batch, CRUD-y operations
How to perform basic CRUD operations (especially batch) by playing with DDD and CQRS?
Let's say I have a list of IDs in my controller that need to be removed (soft delete). Currently, I treat this ...
0
votes
0
answers
208
views
How to model an event-driven system for replays
Let's say I have a system to which I can upload documents via an API. There are three services:
the UploadService - responsible for providing a HTTP endpoint
the StorageService - responsible for ...
0
votes
3
answers
970
views
Should I perform simple validation (not null, max length, etc.) in a web api controller and duplicate in a command handler?
I have a question about DDD. I wonder if I should add validation in a web api controller and duplicate it in a command handler? Is it good approach to validate a DTO and a command even if the ...
0
votes
0
answers
374
views
.Net Core Api - multiple Dto’s for single entity
I want to know the best Practice is about having multiple dto’s for different use cases.
Let’s say we have an api with a set of controllers to handle requests coming from a administration backend and ...
0
votes
1
answer
397
views
One read model project/microservice for all other bounded contexts - is it a good idea?
I have three bounded contexts: Users (generic subdomain), Groups (supporting subdomain) and Events (core domain). Basically users can create/join groups, create events within those groups, and sign up ...
1
vote
1
answer
297
views
What to improve/change and how to move forward with my Event Storming session?
I'm doing alone session with Event Storming for my application that I plan to build with DDD approach later on. Event Storming session is for learning purposes.
My application domain logic is rather ...
2
votes
2
answers
2k
views
CQRS MediatR Create many items commad - is it a good practise?
I am here to ask question about:
is it good practice to insert many records using CQRS and MediatR?
how to structure that in terms of names and folders?
A have to insert into database over 500 ...
1
vote
4
answers
909
views
Should queries in CQRS be designed based on external demand?
I'm working in a microservice application which has some level of coupling between the microservices (some of them talk with each other via rest api - I know it is bad, but it is what it is; also I ...
0
votes
1
answer
267
views
DDD+CQRS - Should I always check if the Databases are online?
I'm developing an intranet application and I'm trying to use some concepts from Domain Driven Design (DDD) and Command and Query Responsibility Segregation (CQRS) in .NET Core, with EFCore.
But, to ...
0
votes
0
answers
232
views
Saga / Processmanager?
I'm thinking about this scenario:
I can receive customer inquiries by Email.
Those inquiries can be sent from existing customers or unknown "customers" - I'll call latter "Leads".
...
0
votes
1
answer
380
views
Should Commands always be a facade to inner layers in CQRS?
In a DDD-CQRS scenario, should my commands in the Application/Service layer always be just a facade to different aggregation method and other inner layers like repository calls in the infrastructure ...
1
vote
2
answers
2k
views
In CQRS/ES should database calls be done in command handlers or domain models?
In the context of a DDD application following CQRS and the event sourcing pattern, I have 2 questions.
At which layer should the direct calls to the Infrastructure layer be made? At the Application ...
0
votes
2
answers
212
views
May the left-side know the right-side when using CQRS with Hexagonal?
I'm trying to use the hexagonal architecture but I want the flexibility to make CUSTOM queries right to the database (or cache) to populate DTOs right from the left-side without passing through the ...
1
vote
0
answers
542
views
Authorization and Cross-Cutting Concerns in DDD (CQRS) - Filtering Data
We are currently in the early phases of developing several applications that differ significantly in their functionality. As part of building these applications, we have also developed a few generic ...
0
votes
1
answer
136
views
Duplicate Query rest end points in microservices - CQRS
I am a newbie to microservice. Currently I'm learning microservices by creating 2 microservices with CQRS pattern, with NO event sourcing, but each service has separate DB. Each service has separate ...
3
votes
2
answers
825
views
Microservices: Is the Saga Pattern correctly applied here?
I'm trying to understand and learn how to build microservice messages the best and came up with this task for myself:
Services given:
Accounts Service
Token Service
Email Service
When a user ...
1
vote
2
answers
456
views
CQRS: Is it an antipattern if the Command invokes a database interface which contains business logic?
Martin Fowler states that,
Command module executes validations and consequential logic
which aligns with every CQRS demo app that I've studied.
That is to say: validation -- does this Jedi exist? -- ...
3
votes
0
answers
503
views
Implementation of projections in event-sourced system
I'm working on a application which uses event-sourcing and CQRS to define it's domain model.
Background
We have implemented projections to aggregate stream of all domain events into a read models used ...
2
votes
0
answers
298
views
Where does a Process Manager live with a Hexagonal/Ports and Adapters Architecture?
Context: I initially asked this question. I lacked some understanding and phrasing to ask the actual question I wanted to ask. The answer though helped me understand the friction points a bit better ...