Understanding when to use stateful services and when to rely on external persistence in Azure Service Fabric

后端 未结 3 1849
礼貌的吻别
礼貌的吻别 2021-01-30 02:58

I\'m spending my evenings evaluating Azure Service Fabric as a replacement for our current WebApps/CloudServices stack, and feel a little bit unsure about how to decide when ser

3条回答
  •  你的背包
    2021-01-30 03:26

    I know this has been answered, but recently found myself in the same predicament with a CQRS/ES system and here's how I went about it:

    1. Each Aggregate was an actor with only the current state stored in it.
    2. On a command, the aggregate would effect a state change and raise an event.
    3. Events themselves were stored in a DocDb.
    4. On activation, AggregateActor instances read events from DocDb if available to recreate its state. This is obviously only performed once per actor activation. This took care of the case where an actor instance is migrated from one node to another.

提交回复
热议问题