What is an actor?

An actor is a computational entity that, in response to a message it receives, can concurrently:

 

  • send a finite number of messages to other actors;
  • create a finite number of new actors;
  • designate the behavior to be used for the next message it receives.

 

There is no assumed sequence to the above actions and they could be carried out in parallel.

  • Carl Hewitt, Peter Bishop, Richard Steiger.  "A Universal Modular Actor Formalism for Artificial Intelligence".
    International Joint Conferences on Artificial Intelligence (1973)

 

  • Gul Agha. Actors: A Model of Concurrent Computation in Distributed Systems.
    MIT Press (1986)

Popularized by Ericsson in the 80s and 90s for building highly reliable telephony applications written in Erlang

Why Actors?

Default Supervisor Strategy

def supervisorStrategy: SupervisorStrategy = {
  OneForOneStrategy(){
    case _: ActorInitializationException ⇒ Stop
    case _: ActorKilledException         ⇒ Stop
    case _: DeathPactException           ⇒ Stop
    case _: Exception                    ⇒ Restart
  }
}

akka-remote and akka-cluster

  • thread-pool-executor
  • fork-join-executor

Comes in two flavors: