CQRS之旅——旅程5(准备发布V1版本) (2)

下图说明了在V1版本中Contoso会议管理系统的关键体系架构。该应用程序由两个网站和三个限界上下文组成。基础设施包括Microsoft Azure SQL数据库(SQL Database)实例、事件存储和消息传递基础设施。

图后面的表列出了图中显示的构件(聚合、MVC控制器、读取模型生成器和数据访问对象)相互交换的所有消息。

备注:为了清晰,图中没有展示Handlers(把消息发送给领域对象的类,例如:OrderCommandHandler)。

元素 类型 发送 接收
ConferenceController   MVC Controller   N/A   ConferenceDetails  
OrderController   MVC Controller   AssignSeat
UnassignSeat
  DraftOrder
OrderSeats
PricedOrder
 
RegistrationController   MVC Controller   RegisterToConference
AssignRegistrantDetails
InitiateThirdPartyProcessorPayment
  DraftOrder
PricedOrder
SeatType
 
PaymentController   MVC Controller   CompleteThirdPartyProcessorPayment
CancelThirdPartyProcessorPayment
  ThirdPartyProcessorPaymentDetails  
Conference Management   CRUD Bounded Context   ConferenceCreated
ConferenceUpdated
ConferencePublished
ConferenceUnpublished
SeatCreated
SeatUpdated
  OrderPlaced
OrderRegistrantAssigned
OrderTotalsCalculated
OrderPaymentConfirmed
SeatAssigned
SeatAssignmentUpdated
SeatUnassigned
 
Order   Aggregate   OrderPlaced
OrderExpired
OrderUpdated
OrderPartiallyReserved
OrderReservationCompleted
OrderPaymentConfirmed
OrderRegistrantAssigned
  RegisterToConference
MarkSeatsAsReserved
RejectOrder
AssignRegistrantDetails
ConfirmOrderPayment
 
SeatsAvailability   Aggregate   SeatsReserved
AvailableSeatsChanged
SeatsReservationCommitted
*SeatsReservationCancelled
  MakeSeatReservation
CancelSeatReservation
CommitSeatReservation
AddSeats
RemoveSeats
 
SeatAssignments   Aggregate   SeatAssignmentsCreated
SeatAssigned
SeatUnassigned
SeatAssignmentUpdated
  AssignSeat
UnassignSeat
 
RegistrationProcessManager   Process manager   MakeSeatReservation
ExpireRegistrationProcess
MarkSeatsAsReserved
CancelSeatReservation
RejectOrder
CommitSeatReservation
ConfirmOrderPayment
  OrderPlaced
PaymentCompleted
SeatsReserved
ExpireRegistrationProcess
 
OrderViewModelGenerator   Handler   DraftOrder   OrderPlaced
OrderUpdated
OrderPartiallyReserved
OrderReservationCompleted
OrderRegistrantAssigned
 
PricedOrderViewModelGenerator   Handler   N/A   SeatTypeName  
ConferenceViewModelGenerator   Handler   Conference
AddSeats
RemoveSeats
  ConferenceCreated
ConferenceUpdated
ConferencePublished
ConferenceUnpublished
SeatCreated
SeatUpdated
 
ThirdPartyProcessorPayment   Aggregate   PaymentCompleted
PaymentRejected
PaymentInitiated
  InitiateThirdPartyProcessorPayment
CompleteThirdPartyProcessorPayment
CancelThirdPartyProcessorPayment
 

标记*的这些事件仅用于使用事件源持久化聚合状态。

标记**的是ConferenceViewModelGenerator从SeatCreated和SeatUpdated事件创建的这些命令,这些事件在会议管理限界上下文中处理。

下面的列表概述了Contoso会议管理系统中的消息命名约定

所有事件在命名约定中都使用过去时。

所有命令都使用命令式命名约定。

所有的DTO都是名词。

该应用程序旨在部署到Microsoft Azure。在旅程的那个阶段,应用程序由两个角色组成,一个包含ASP.Net MVC Web应用程序的web角色和一个包含消息处理程序和领域对象的工作角色。应用程序在写端和读端都使用Azure SQL DataBase实例进行数据存储。订单(Order)和注册(Registrations)限界上下文现在使用事件存储在写端持久化状态。此事件存储是使用Azure table storage来实现的。应用程序使用Azure服务总线来提供其消息传递基础设施。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpjgxy.html