cqrs

Accessing a web service from CQRS

余生颓废 提交于 2020-01-01 09:03:05
问题 Supposed I have a CQRS-based system and my domain needs some data from an external web service to make its decisions. How do I model this correctly? I can think of two options: The command handler runs the domain logic and the domain itself calls out to the web service. Once it gets a response, it attaches the appropriate events to the current aggregate and stores them. The domain basically "waits" for the web service to return. The command handler runs the domain logic and the domain

Accessing a web service from CQRS

末鹿安然 提交于 2020-01-01 09:02:10
问题 Supposed I have a CQRS-based system and my domain needs some data from an external web service to make its decisions. How do I model this correctly? I can think of two options: The command handler runs the domain logic and the domain itself calls out to the web service. Once it gets a response, it attaches the appropriate events to the current aggregate and stores them. The domain basically "waits" for the web service to return. The command handler runs the domain logic and the domain

CQRS - how to model a scenario execution system

限于喜欢 提交于 2020-01-01 02:44:06
问题 I recently started investigating CQRS and DDD for a green field project that I'm about to start. I studied a great deal of material from Udi Dahan, Greg Young, Mark Nijhof and others. These were really very helpful and I think I have a good understanding of the concepts. But, there are still certain questions on my mind on how I can apply these to my own domain. My system will basically be a complex rules engine - in which rules will dictate the final price of certain products. The product

What should be returned from the API for CQRS commands?

偶尔善良 提交于 2020-01-01 02:10:12
问题 As far as I understand, in a CQRS-oriented API exposed through a RESTful HTTP API the commands and queries are expressed through the HTTP verbs, the commands being asynchronous and usually returning 202 Accepted , while the queries get the information you need. Someone asked me the following: supposing they want to change some information, they would have to send a command and then a query to get the resulting state, why to force the client to make two HTTP requests when you can simply return

What should be returned from the API for CQRS commands?

瘦欲@ 提交于 2020-01-01 02:10:06
问题 As far as I understand, in a CQRS-oriented API exposed through a RESTful HTTP API the commands and queries are expressed through the HTTP verbs, the commands being asynchronous and usually returning 202 Accepted , while the queries get the information you need. Someone asked me the following: supposing they want to change some information, they would have to send a command and then a query to get the resulting state, why to force the client to make two HTTP requests when you can simply return

Passing CQRS commands directly to Domain objects

女生的网名这么多〃 提交于 2019-12-31 17:49:06
问题 ~TLDR: I'm implementing a CQRS + DDD solution for one of my larger projects, and, I'm wondering if there is any real reason that my command handlers can't directly dispatch the command objects to my aggregates, in a small handful of cases, where the command object is data rich? I can't find any specific reason why this would be any kind of an anti-pattern, and I can't find any opinions that go into great detail about this type of design. Background: I have implemented CQRS systems before, and

Passing CQRS commands directly to Domain objects

此生再无相见时 提交于 2019-12-31 17:49:03
问题 ~TLDR: I'm implementing a CQRS + DDD solution for one of my larger projects, and, I'm wondering if there is any real reason that my command handlers can't directly dispatch the command objects to my aggregates, in a small handful of cases, where the command object is data rich? I can't find any specific reason why this would be any kind of an anti-pattern, and I can't find any opinions that go into great detail about this type of design. Background: I have implemented CQRS systems before, and

领域驱动设计DDD和CQRS落地

给你一囗甜甜゛ 提交于 2019-12-31 14:25:19
DDD分层架构 Evans在它的《领域驱动设计:软件核心复杂性应对之道》书中推荐采用分层架构去实现领域驱动设计: image 其实这种分层架构我们早已驾轻就熟,MVC模式就是我们所熟知的一种分层架构,我们尽可能去设计每一层,使其保持高度内聚性,让它们只对下层进行依赖,体现了高内聚低耦合的思想。 分层架构的落地就简单明了了,用户界面层我们可以理解成web层的Controller,应用层和业务无关,它负责协调领域层进行工作,领域层是领域驱动设计的业务核心,包含领域模型和领域服务,领域层的重点放在如何表达领域模型上,无需考虑显示和存储问题,基础实施层是最底层,提供基础的接口和实现,领域层和应用服务层通过基础实施层提供的接口实现类如持久化、发送消息等功能。阿里巴巴开源的整洁面向对向分层架构COLA就采取了这样的分层架构来实现领域驱动。 改进DDD分层架构和DIP依赖倒置原则 DDD分层架构是一种可落地的架构,但是我们依然可以进行改进,Vernon在它的《实现领域驱动设计》一书中提到了采用依赖倒置原则改进的方案。 所谓的依赖倒置原则指的是:高层模块不应该依赖于低层模块,两者都应该依赖于抽象,抽象不应该依赖于细节,细节应该依赖于抽象。 image 从图中可以看到,基础实施层位于其他所有层的上方,接口定义在其它层,基础实施实现这些接口。依赖原则的定义在DDD设计中可以改述为

In CQRS, how do you build the response when creating an entity?

空扰寡人 提交于 2019-12-30 09:09:13
问题 If using CQRS and creating an entity, and the values of some of its properties are generated part of the its constructor (e.g. a default active value for the status property, or the current datetime for createdAt ), how do you include that as part of your response if your command handlers can’t return values? 回答1: You would need to create guid before creating an entity, then use this guid to query it. This way your command handlers always return void. [HttpPost] public ActionResult Add(string

GUI recommandations for eventual consistency?

Deadly 提交于 2019-12-30 04:04:11
问题 When using distributed and scalable architecture, eventual consistency is often a requirement. Graphically, how to deal with this eventual consistency? Users are used to click save, and see the result instantaneously... with eventual consistency it's not possible. How to deal with the GUI for such scenarios? Please note the question applies both for desktop applications and web applications. PS: I'm working with the Microsoft platform, but I imagine the question applies to any technology...