2022 Developer Survey is open! Take survey.

Questions tagged [cqrs]

Command Query Responsibility Segregation design pattern

Filter by
Sorted by
Tagged with
0 votes
1 answer
128 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 ...
user avatar
0 votes
0 answers
57 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 ...
user avatar
0 votes
0 answers
68 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 ...
user avatar
0 votes
3 answers
143 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 ...
user avatar
0 votes
0 answers
75 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 ...
user avatar
0 votes
1 answer
63 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 ...
user avatar
1 vote
1 answer
73 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 ...
user avatar
0 votes
0 answers
24 views

DDD & ES – modeling crossing context between domains

I've been experimenting with DDD, CQRS and Event Sourcing recently as part of a small application I'm writing for my own use. Unfortunately, I'm not quite sure how to play some things out correctly ...
user avatar
  • 1
1 vote
2 answers
152 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 ...
user avatar
0 votes
0 answers
46 views

Can/Should Refit (API) Contracts be the same of MediatR (CQRS) Commands?

I'm creating a microservice using Clean Architecture principles. The following picture shows the project structure: On the Application layer, I am using MediatR (using CQRS), where I have the ...
user avatar
0 votes
4 answers
194 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 ...
user avatar
0 votes
1 answer
130 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 ...
user avatar
0 votes
0 answers
88 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". ...
user avatar
  • 1
0 votes
1 answer
161 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 ...
user avatar
0 votes
2 answers
465 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 be made the direct calls to the Infrastructure layer? At the Application ...
user avatar
0 votes
2 answers
119 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 ...
user avatar
  • 109
0 votes
0 answers
185 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 ...
user avatar
  • 49
0 votes
1 answer
63 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 ...
user avatar
2 votes
1 answer
223 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 ...
user avatar
  • 461
1 vote
2 answers
130 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? -- ...
user avatar
  • 1,339
3 votes
0 answers
237 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 ...
user avatar
  • 35.5k
1 vote
0 answers
107 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 ...
user avatar
  • 2,321
0 votes
1 answer
196 views

In CQRS/ES where does an Aggregate Root belong?

Disclaimer: This question may be related to the framework I'm using to support CQRS/ES rather than the concepts themselves but many of these frameworks implement the same strategies, making me think ...
user avatar
  • 101
4 votes
3 answers
391 views

CQRS: getOrCreate - is this a command, query, or both?

Consider the following scenario: If the user isn't registered in the database, register them. Return their ID. If the user is in the database, return their ID. The API endpoint for this may look ...
user avatar
  • 1,339
0 votes
2 answers
185 views

How to manage primary keys in CQRS

I'm building a backend following the CQRS pattern and I don't know how to manage properly the primary keys (surrogate keys) between the command and query databases. For example: I have a model with ...
user avatar
1 vote
1 answer
141 views

Does CQRS Handler can invoke another Handler because of relations to another Domain?

I have read DDD Vaughn Vernon book. There is a info about CQRS architecture. He mention that Handler can only do one Handler task, which I understand his and he cannot invoke other Handler. And even ...
user avatar
  • 111
0 votes
2 answers
205 views

Is there alternative to applying events synchronously in command handler in CQRS?

I have workflow where I have complex command handlers encapsulated inside aggregate. These handlers emit some events, and then further logic based on result of these events can emit more events. ...
user avatar
  • 101
-1 votes
2 answers
164 views

How to avoid CRUD and layered architectures in REST backends?

I'm creating a .Net 5 API backend and use EF Core for the database part. The simple CRUD way I know: API layer calling a command or query from the application layer using MediatR Application layer ...
user avatar
0 votes
1 answer
233 views

How do I implement a domain entity behaviour that depends on some external infrastructure?

I am in the process of developing some software using CQRS, ES and DDD. A part of the system is writing services for controlling devices and collecting data from them. Consider a "Start" ...
user avatar
  • 11
0 votes
1 answer
389 views

Where to put SaveChanges in unit of work?

For the sake of discussion, you can assume I'm using Entity Framework and a mediator pattern implementation in .NET. I'm going back and forth trying to decide how to structure some of my data access ...
user avatar
2 votes
1 answer
201 views

Microservices: CQRS - how does the command side query data?

I’m trying to think what’s the best approach when I need data present in different services in a microservices-based architecture. In an e-commerce context, when a user creates an order the ...
user avatar
1 vote
1 answer
205 views

C# Design for database queries and commands

Currently I'm working on a project that will interact with a database. Based on my research, I would like to develop a repository class which responsability is to write/extract entities to/from a ...
user avatar
0 votes
3 answers
581 views

How can I coordinate updating multiple Aggregates as a result of one command, without introducing exploitative possibilities?

I'm trying to figure out how to integrate one command that updates multiple Aggregates in different contexts in a video game. The components/considerations for my particular design are DDD, CQRS, ...
user avatar
  • 2,321
-1 votes
1 answer
798 views

How can I orchestrate multiple business tasks?

I have a WebApi backend with a Blazor WASM frontend. The application is split up into 3 main parts. Core, Infrastructure and Presentation. Basic onion architecture structure. Core.Domain Domain ...
user avatar
0 votes
1 answer
318 views

Query authorization in read model for listing items in DDD/CQRS

In my example app there are admins and modules. Each admin may have some permissions to access a module. Also please note that I am assuming "simplified" DDD/CQRS where read models are ...
user avatar
2 votes
2 answers
1k views

Data Repository and Complex Queries (DTO)

Following the classic 3 layer architecture domain Model (a list of entities live there and has no dependencies) DAL layer - My Repositories lives there with DBContext implementation (Ado.net) Dal ...
user avatar
-4 votes
1 answer
681 views

Comparison of CQRS and MVC

Command Query Responsibility Segregation and Model–view–controller patterns look pretty similar to me. Are they comparable? Do they act at the same layer of abstraction? How do they differ? Can they ...
user avatar
  • 123
2 votes
2 answers
130 views

How can we update potentially many Read Model Projections based on an Event that is not within the native context?

I have a Shop which sells Items for a given Price. To be clear, this is in the context of a video game, not an enterprise ERP system. The game operator can create Shops that Players can use to buy ...
user avatar
  • 2,321
0 votes
2 answers
357 views

In an event sourced system, how do I get a current state of an entity?

Let's assume I use Kafka as an event store and put there all the lifecycle events of an order. Now I need to get the current state of this order in my system in during some business process. What's ...
user avatar
4 votes
1 answer
469 views

DDD and CQRS in web applications

Premise A web application that has a frontend / backend separation. The frontend can be the JS framework of the month, which talks to a REST API in the backend. The backend part of the system accepts ...
user avatar
  • 3,458
0 votes
0 answers
75 views

How to name multiple entities returned from a Query Handler?

I've got the following flow: HTTP API is exposing data from 2 database tables that are combined into one JSON structure. We're implementing this using CQRS - splitting the reads from multiple tables ...
user avatar
1 vote
1 answer
404 views

Upholding business logic and invariants in an event sourced CQRS architecture

My understanding of a CQRS architecture is that a micro-service is split to two servers each with its own database such that the first server handles all the writes and the second server handles all ...
user avatar
  • 13
2 votes
1 answer
363 views

Event Sourcing - More complex example

Usually when I read Event Sourcing examples - they are pretty simple. When trying to implement something even more complex - it seems to get pretty ugly pretty quickly. Let me explain this on one ...
user avatar
3 votes
1 answer
1k views

Moving shared CQRS/Mediatr Request Handler logic into services and avoiding code/logic duplicity?

We recently embraced Clean Architecture and CQRS, by way of Mediatr, in several of our new applications. A similar (SPA-based) demo can be seen here. For many of our WebApi-based projects, this worked ...
user avatar
  • 1,317
1 vote
2 answers
519 views

Primitive obsession, value objects, Commands, Events and where to convert

I tried to combine two rules. Don't fall to primitive obsession (e.g. EMailAddress should be a value object in domain objects and not a string). Don't use value objects in commands and events.1, 2, 3 ...
user avatar
  • 111
1 vote
0 answers
44 views

Specifications Pattern crossing bounded context - Domain Driven Design

I'm trying to understand and implement with good practice the Specification Pattern within my domain driven design project. I have few questions: For example: verifying that a customer is subscribed ...
user avatar
-3 votes
1 answer
90 views

How to get Address pincode inside Customer class

I have 2 domains Customer and Address using using EventSourcing and CQRS in our Monolithic app, below is my query: Customer Domain: class Customer { //Aggregate class String custId; ...
user avatar
  • 109
2 votes
2 answers
499 views

In which database CQRS Command performs a Query?

I read the discussion Should CQRS Command perform a Query? But I don't understand in which database the query is performed, because I have two distinct databases - one for reads (queries) and one for ...
user avatar
1 vote
1 answer
91 views

designing events for an event sourcing based application

In an application to handle employee leaves, I decided to try CQRS & event sourcing and came up with the following flow of events. app events leave-application-received leave-application-...
user avatar
  • 143
3 votes
3 answers
2k views

Event Sourcing - Multiple events or a single for a change on one aggregate?

I have a checklist system where we are implementing CQRS/ ES (Event Sourcing). We have a command updateStatus(taskId: string, status: boolean) to mark a task or sub task as completed. If I receive a ...
user avatar
  • 279

1
2 3 4 5 6