If the state of the entries are persistent you may stop entries that are not used to
reduce memory consumption. This is done by the application specific implementation of
the entry actors for example by defining receive timeout (context.setReceiveTimeout).
If a message is already enqueued to the entry when it stops itself the enqueued message
in the mailbox will be dropped. To support graceful passivation without loosing such
messages the entry actor can send this Passivate message to its parent ShardRegion.
The specified wrapped stopMessage will be sent back to the entry, which is
then supposed to stop itself. Incoming messages will be buffered by the ShardRegion
between reception of Passivate and termination of the entry. Such buffered messages
are thereafter delivered to a new incarnation of the entry.
If the state of the entries are persistent you may stop entries that are not used to reduce memory consumption. This is done by the application specific implementation of the entry actors for example by defining receive timeout (
context.setReceiveTimeout
). If a message is already enqueued to the entry when it stops itself the enqueued message in the mailbox will be dropped. To support graceful passivation without loosing such messages the entry actor can send thisPassivate
message to its parentShardRegion
. The specified wrappedstopMessage
will be sent back to the entry, which is then supposed to stop itself. Incoming messages will be buffered by theShardRegion
between reception ofPassivate
and termination of the entry. Such buffered messages are thereafter delivered to a new incarnation of the entry.akka.actor.PoisonPill is a perfectly fine
stopMessage
.