我正在为我们的应用程序实现域事件框架,下面是相同的伪代码,想知道是否有任何明显的警告
该框架将设计为 2 步,以便持久化领域事件(以便稍后重建模型状态以防万一,或者我们可能会添加一个报告系统)和发布基础设施
存储
begin txn
update model
Domaineventpublsisher.publish(event)
events serialized and stored to the persistence store by the Domaineventpublisher
commit txn
出版
timer triggers and the registered event dispatchers are notified
event dispatcher reads from of db unsent events
begin txn
the unsent events are published thro rabbitmq and persistence is updated with the last dispatched event
commit txn
这是我根据一些研究可以想出的最简单的方法,只是不想忽略任何东西。
持久性将是连接池 Postgres,如前所述,RabbitMQ 将是消息传递基础。