问题
In Akka, when an actor dies while processing a message (inside onReceive(...) { ... }
, that message is lost. Is there a way to guarantee losslessness? Is there a way to configure Akka to always persist messages before sending them to onReceive
, so that they can be recovered and replayed when the actor does die?
Perhaps something like a persistent mailbox?
回答1:
Yes, take a look at Akka Persistence, in particular AtLeastOnceDelivery. This stores messages on the sender side in order to also cover losses during the delivery process, because otherwise the message might not ever reach the destination mailbox.
来源:https://stackoverflow.com/questions/30674296/persistent-akka-mailboxes-and-losslessness