Questions tagged [cqrs]

Command Query Responsibility Segregation design pattern

Filter by
Sorted by
Tagged with
0
votes
0answers
40 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 ...
0
votes
2answers
66 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 ...
0
votes
1answer
43 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 ...
0
votes
0answers
52 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
1answer
38 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 ...
1
vote
1answer
98 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
2answers
87 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
0answers
113 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 ...
0
votes
0answers
46 views

CQRS command with complex creational logic

I have a domain model that defines the various aggregated levels (values by city, state, etc.) of historical data used by an associated web application. There are hundreds of these 'DomainData' ...
0
votes
0answers
67 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 ...
0
votes
1answer
66 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 ...
4
votes
3answers
199 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 ...
1
vote
2answers
124 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 ...
0
votes
1answer
60 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 ...
0
votes
2answers
153 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. ...
-1
votes
2answers
133 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 ...
0
votes
1answer
71 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" ...
0
votes
1answer
140 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 ...
2
votes
1answer
147 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 ...
1
vote
1answer
131 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 ...
0
votes
3answers
133 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, ...
0
votes
1answer
266 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 ...
0
votes
1answer
103 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 ...
0
votes
0answers
109 views

In CQRS is it acceptable for an event handler to access a query?

This question is somewhat linked to Should CQRS Command perform a Query? where there is a detailed discussion which in summary indicates that when using CQRS, Commands and Queries should not call ...
2
votes
2answers
301 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 ...
-3
votes
1answer
234 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 ...
2
votes
2answers
118 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 ...
0
votes
2answers
192 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 ...
3
votes
1answer
277 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 ...
0
votes
0answers
48 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 ...
1
vote
1answer
234 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 ...
2
votes
1answer
177 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 ...
2
votes
1answer
713 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 ...
0
votes
2answers
344 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 ...
1
vote
0answers
29 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 ...
-3
votes
1answer
89 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; ...
2
votes
2answers
255 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 ...
1
vote
1answer
76 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-...
2
votes
3answers
824 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 ...
0
votes
1answer
198 views

DDD bounded context between three Aggregates that share the same address entity and CQRS

We have many different aggregates that use an address entity. But we also have an address aggregate because we have a global address book as well. Aggregate Company has many Address Entities ...
2
votes
1answer
173 views

Event Sourcing/CQRS for Self-Related Entities

I'm building a platform that has an entity named content. There's a clear boundary around what defines content except that it can have relationships with other content entities. Up until now, there's ...
0
votes
1answer
91 views

CQRS for avoiding heavy joins

I've been wondering about what is a perfect use case for CQRS where the benefits overcome the complexity and the cost with come with the package. So for me to better understand it, I want to share ...
3
votes
3answers
968 views

What are the problems with command handlers returning data in CQRS?

I have a system using CQRS/ES, where: The command handlers are actually implemented as an application service layer, which executes synchronously. I.e. events are persisted in the event store before ...
2
votes
2answers
236 views

Entity delete validation in a microservice environment

In a microservice environment there are two services: Service A and Service B. Service A manages an entity called x which has one to many relationship with service B's entity called y When a network ...
1
vote
1answer
172 views

DDD - Concurrency and Command retrying with side-effects

I am developing an event-sourced Electric Vehicle Charging Station Management System, which is connected to several Charging Stations. In this domain, I've come up with an aggregate for the Charging ...
0
votes
0answers
224 views

CQRS denormalized data query with multiple aggregates

Let's say there's a domain that's similar to Reddit. Aggregate roots are Board // you can ignore this - boardId Post - postId - userId User - userId - username where each aggregate emits ...
-1
votes
2answers
204 views

Merging aggregates with Event sourcing

I'm currently evaluating Event Sourcing and CQRS for an implementation of a new business requirement at my day job. While I can't really speak about the actual business problem, I can give a few ...
0
votes
1answer
102 views

Message bus: should an event handler trigger other commands?

Given I have a message bus that can handle commands and events. A command handler can dispatch an event. But should an event handler be able to dispatch another command? Or should event handlers only ...
-1
votes
3answers
944 views

How does “event triggers event” really work in Event Sourcing / CQRS?

After reading/watching a lot about Event Sourcing, there is one thing I don't fully understand: Events that lead to triggering of other events. Let's take StackExchange's "close question" feature as ...
-4
votes
1answer
44 views

What do you store first in a CQRS + ES architecture

I've recently started reading about CQRS, DDD and EventSourcing. From what I've read one of the best ways to do ES is to have an event store and then a regular DB or cache for easier querying. However,...

1
2 3 4 5 6