アプリケーションのドメイン イベント フレームワークを実装しています。以下は同じ疑似コードです。明らかな注意事項があるかどうかを知りたいです。
フレームワークは、ドメイン イベント (必要に応じて後でモデルの状態を再構築するため、またはミックスにレポート システムを追加するため) とパブリッシング インフラストラクチャを永続化するための 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 はメッセージング インフラになります。