Questions tagged [cqrs]

Command Query Responsibility Segregation design pattern

Filter by
Sorted by
Tagged with
0
votes
0answers
9 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
1answer
122 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
16 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
86 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
104 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
56 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
158 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 ...
1
vote
1answer
70 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
128 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
77 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 ...
2
votes
3answers
206 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
104 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
73 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
73 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
79 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
39 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 ...
-2
votes
3answers
191 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 ...
0
votes
0answers
35 views

Read models creation, maintaining in stateless sevices CQRS

In a microservices based web backend, most of the services (Node.js) contain modules to handle read and write data separately. When that particular service restarts it grabs the data from other ...
-3
votes
1answer
35 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
votes
1answer
41 views

Does logged-in User information belong on a Command?

Imagine I am creating a command called UpdatePhoneNumberCommand. Imagine also that in my application a business rule dictates that no-one may update anyone else's phone number - it is always you ...
2
votes
1answer
415 views

Event sourcing and sync between write and read model

I am creating this project based on event sourcing and cqrs. My write and read model are on different databases (and machines) and are connected through an event bus (in particular I am using ...
1
vote
1answer
93 views

Designing frontend experience to support backend async CQRS operations

I'm developing a microservice with CQRS and Event Sourcing. When an event is saved to the event store, the service currently also saves the updated aggregate root as a JSON object in a separate table. ...
2
votes
2answers
441 views

CQRS - How can a command properly validate when queries are required?

I'm aware that this question has been asked several times, but I have some concerns regarding querying from the write side that I don't see addressed in the already existing questions, more ...
0
votes
2answers
146 views

Modify Command object inside decorator of CommandHandler(CQRS) or any other practice for avoiding duplication

Currently, we have multiple commands which share two same properties (BookName and ShopId). While handling those commands those properties must be validated with the help of some service. Let's say ...
2
votes
1answer
249 views

Determining an appropriate use case for CQRS

I'm building an application which lets users view a large amount of data about a single single entity (lets say it displays a users health profile for the day) via a single webpage. The data comes ...
2
votes
0answers
44 views

Event sourcing and state set event

I'm trying out commanded framework for Elixir that implements event sourcing and CQRS (it have abstract structure of command, command middleware, router, aggregate, process manager, projection and ...
0
votes
0answers
60 views

Is one to one mapping necessary between Write Applications and Read Applications

Introduction: We have a bunch of micro services (about 40) to serve our customers. To facilitate scaling and audit-ability of selected few micro services we have decided to redesign them using CQRS ...
0
votes
0answers
270 views

DDD Monolith eshop architecture based on multiple BoundedContexts Question

I´m creating my first eshop / CMS based on DDD / CQS concepts. I want to create application using BoundedContexts separtion as modular monolith at the first stage and maybe latter extract some BC as ...
2
votes
1answer
560 views

Reducing the code duplication between read and write application in CQRS

I am building an application and trying to embrace Domain Driven design principles, CQRS and event sourcing. We are having two applications one for reading and another for writing. The write ...
2
votes
1answer
149 views

ES/CQRS: How to access additional information in projections

I'm developing an event-sourced/CQRS application and do not understand the best strategy to use when building the read model projections when additional domain data is needed. A partial representation ...
2
votes
2answers
595 views

Dealing with property-level permissions in DDD and should UI or authorization influence the domain model?

Suppose I have a command like below: public sealed class UpdateExampleCommand { public int Field1 { get; set; } public string Field2 { get; set; } public bool Field3 { get; set; } ...
2
votes
0answers
54 views

Commiting transaction in the repository instead of the application service

After quite some time thinking about it, and testing both methods, I'm really struggling with choosing the right manner to commit my transactions. To shape the context, we are in the context of ...
2
votes
1answer
48 views

How specific should administrative compensating events be in a CQRS/ES system?

Are there any best practices around how specific to make events that are generated administratively, say to clean up after one-off operational issues? For example: Say you have a credit card ...
3
votes
2answers
462 views

How to deal with UI data requirements in DDD

I'm using DDD and a CQRS/Event Sourcing architecture so my domain logic is separated in a microservice (e.g: command service) and the read side is in another microservice (e.g: query service). We ...
0
votes
1answer
190 views

Is it overkill to use event sourced actor model with message queue which send commands from gateway?

The gateway uses Rabbitmq with Masstreansit to send commands to services. Some of services require event sourcing in their internal architecture. Since I need my aggregate states available, and the ...
0
votes
1answer
268 views

What is the most appropriate way to launch an API gateway on a massive domain?

We're trying to develop a comprehensive system which has broken down to multiple microservices. So we decided to use CQRS and DDD to tackle the complexities of the domain. Also we’re about to launch ...
2
votes
0answers
56 views

Should perform query at the point of time for the event or the actual time when working with CQRS for queue system?

I'm trying to implement CQRS for a queue system where user can join a queue by clicking a button. The system will tell the user if queue is full. When the user click the button, it raised the ...
2
votes
1answer
222 views

How to split Aggregate Root that have equal identity?

In DDD, creating smaller aggregates is encouraged where possible, but in a system we are designing we are running into an issue regarding the identity of aggregates. The system evolves around ...
-1
votes
1answer
2k views

CQRS and GraphQL

Context Domain I have a CQRS domain with requests, authorizers, handlers, response objects, entities, filters, pagination. It only depends on: external services (email, other APIs, etc...) a ...
0
votes
0answers
180 views

In a DDD CQRS API, is it preferable to have a separate DTO per query or per representation of a resource?

I am in the middle of starting up a new project and just wanted some reassurance as to which approach to DTO's returned by the read-side was easier to maintain in a real world application with ...
0
votes
1answer
137 views

DDD and CQRS - Define an entity for Scheduling use case

I have a use case of scheduling a person to some work for some time range. Eg. A service for assigning a person A to work for time range X to Z in location C. The only constraint it has, is one ...
0
votes
2answers
76 views

How to check if the command is execuable when it delivers through asynchronous message queue?

The aggregate root's state is the product of the commands it receives. So different order of receiving the commands produce different aggregate root states. How can I check domain rules based on the ...
0
votes
1answer
359 views

What's the use of event sourcing and asynchronous message queues for sending commands

In short: Out of order commands end up with out of order events, so does the ordering of the events matter in such situations? Since we are uncertain about the order of commands when an asynchronous ...
4
votes
2answers
382 views

CQRS sequential numbering of business documents

I am currently building a microservice-based system to learn CQRS/ES, Docker, AMQP and all the other goodies that goes with it. I have never asked a question online before as I am usually pretty good ...
0
votes
1answer
277 views

How to handle Domain Event handlers ordering

Background: we have 2 bounded context: Inventory and Sale application context is Point-of-sale system Scenario: When a Checkout happen on Sale BC, we would like to decrease quantity in Inventory. ...
0
votes
1answer
72 views

Storing within the domain or use CQRS?

Assume we're building a fleet management system that is monitoring telemetry on a fleet of cars. Important telemetry include like location, speed and engine temperature. Metrics are mostly dynamic and ...
2
votes
2answers
146 views

Is it a bad practice or uncommon to save “Invalid operation attempted” events in an Event Store when doing Event Sourcing?

I have a simple toy project that deals with Banking operations (cash deposit, withdrawals, wire transfers, open and close accounts). I am wondering whether there is something wrong about saving ...
1
vote
1answer
165 views

Are separate controllers used when adopting full scale CQRS?

I understand there are three flavours of CQRS: 1) Separate models only i.e. a domain model and a read model. 2) separate models and repositories. 3) Separate models; repositories and physical ...
1
vote
2answers
182 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
96 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 ...

1
2 3 4 5