English 中文(简体)
CQRS 和电子邮箱通知
原标题:CQRS and email notification

阅读CLCS时,有很多人谈到电子邮件通知,想从哪里获得数据。 Imagine a senario, 一名用户邀请其他用户参加一次活动。 为了通知用户他已被邀请参加某项活动,他收到电子邮件。

具体步骤可能类似:

  1. A CreateEvent command with an associated collection of users to invite, is received by the server.
  2. A new Meeting aggregate is created and a method InviteUser is called for each user that is to be invited.
  3. Each time a user is invited to an event, a domain event UserWasInvitedToEvent is raised.
  4. An email notification sender picks up the domain event and sends out the notification email.

现在我的问题是: 我在什么地方要把信息列入电子邮件?

Say,我想介绍活动以及用户名称。 既然是CQRS,我就能够 t弄我的领域模式;所有领域物体的特性都是私人的! 那么,我是否应该问一下: 或者将电子邮件通知完全转移到另一个部门?

问题回答

在CLCS,你将指挥与盘问方面重新分开。 你们总是想去问答,以便获得某个活动手的数据。 书面数据库将是一个单独的数据库,其中包含建立您域名所需的数据,不会优化成文,而是书面数据。

  1. The domain should register and send an EventCreated event to the event handlers / processors. This could be raised from the constructor of the Meeting aggregate.
  2. The event processing component would pick up the EventCreated event, and update the query database with the data contained in the event (ie, the Id of the event and its name).
  3. The domain could register and send a UserWasInvitedToEvent event to the event processors.
  4. The event processors would pick up the UserWasInvitedToEvent and update the query store with any reporting data necessary.
  5. Another event processing component would also pick up the UserWasInvitedToEvent event. This process could have access to the query database and pull back all of the data necessary for sending the email.

查询数据库只不过是一个报告数据库,因此,你甚至可以有一个具体表格,储存电子邮件所需的全部数据。

为了将若干不同的事件合并成单一手提(假设事件可以在不同时间以不同顺序处理),你可以利用“Saga。 NPO 客车是一部大型公共汽车的例证,这些汽车支持Saga s。 See this StackOverflow question as well: NSERBus Delayed 信处理





相关问题
Angle brackets in php

I want to store angle brackets in a string in PHP because i want to eventually use mail() to send an HTML email out. The following is the code that doesn t seem to work. while(...) { $msg .= "<...

authlogic auto_register feature using my options

I have auto registration working with authlogic using gaizka s version of authlogic_openid which I found on Github since pelle s original addition of the feature seemed to cause issues. http://...

Zend 邮件问题,涉及外国char子+ com子

泽斯德邮局在名称被定为具有外国性质(如“保”)和 com(”)的物品时,就放弃了一种例外(因为邮局(邮局)退回假)。 重新提出以下守则。

How to track an email in Java?

How I can track an email? I m using java on the server side for sending emails. I want to track whether it is delivered , opened, etc... How I can do that ?

Web Link in a mail is not rendering as link in yahoo

string from = "abc@gmail.com"; string to = "xyz@gmail.com,xyz@yahoo.co.in"; string password="abcxyz"; MailMessage mail = new System.Net.Mail.MailMessage(); mail.To.Add(to); mail.From = new ...

SharePoint - Approaching Website Storage Limit Email

How can i go about changing the distribution list as well as the email text for the email that goes out to site collection admin when a site collection approaches it s size limit? Thanks for your ...

How to create an email mailing list

Im creating a coming soon page for a website im developing, and im adding an option for the user to enter their email address so we can email them when the site is up. How do I do this?

CCNet email does not include MSBuild results

We re using CCNet 1.4.4.83 but when an MSBuild task fails, we don t get the MSBuild results (i.e. missing file or whatever reason the compile failed) in the email notification. I do see the build ...

热门标签