Akka - resending the “breaking” message

前端 未结 1 772
没有蜡笔的小新
没有蜡笔的小新 2021-02-18 13:56

In the official akka 2.0.4 docs it says:

An actor restart replaces only the actual actor object; the contents of the mailbox is unaffected by the restart,

1条回答
  •  清歌不尽
    2021-02-18 14:32

    You already get the failing message in preRestart (see: message: Option[Any]) so no need to stash it away yourself. And yes, it is perfectly fine to re-send it to yourself, but beware of infinite restarts in combination with this since you'll most likely end up with a message that will never be discarded.

    0 讨论(0)
提交回复
热议问题