Restarting erlang process and preserving state

后端 未结 3 1279
清酒与你
清酒与你 2021-02-06 07:01

I have a supervisor process which starts number of child processes. Currently when the child dies I spawn a new process with new Pid. This means I loose the state information of

3条回答
  •  日久生厌
    2021-02-06 07:42

    Use eventsourcing, persist all events, and replay back to reconstruct the state. In case you need fast replays, make a snapshot. The example below: https://github.com/bryanhunter/cqrs-with-erlang/tree/ndc-oslo

    In fact, it would be nice to build a complete framework based on this example.

提交回复
热议问题