Defining, creating, and messaging actors
The actors are defined as classes that inherit from the Actor
class from the Akka library:
class HelloWorld extends Actor {
Actor exposes the following abstract API:

The only method that is abstract in Actor
is the receive
method. Akka calls this method when an actor needs to handle an incoming message. It returns a partial function from Any
to Unit
. This means that it is capable of handling a message from a domain of all objects, and it is supposed to produce some side effects while handling this message, which is indicated by the Unit
return type. That function is a partial function, which means that it can handle only a part of the input Any
domain that your actor is interested in.
When your define an actor, you override this method to define what the actor must do:
val log = Logging(context.system, this) def receive = { case Ping ⇒ log.info("Hello World") }
The message is defined as follows:
case object Ping
So, when an actor receives the ping message...