- Name two ways in which an actor can change itself in response to the received message.
An actor can mutate its internal state using a var field. This is a classical object-oriented approach.
Another way is to use context and become close over some value which will become part of the new state. The context.become can also be used to change the behavior of the actor completely. This is a more functional approach because both state and behavior are in fact immutable.
- What is the purpose of ActorRef?
The ActorRef provides a means to address an actor via the actor path. It also encapsulates an actor's mailbox and a dispatcher. Actors in Akka communicate via ActorReference.
- Look up in the official documentation the description of the system guardian. What is the main purpose of it?
The main purpose of the system guardian is to supervise system level actors. It...