User overridable callback/setting.
User overridable callback/setting.
Partial function implementing the actor logic. To be implemented by concrete actor class.
Example code:
def receive = { case Ping => println("got a 'Ping' message") self.reply("pong") case OneWay => println("got a 'OneWay' message") case unknown => println("unknown message: " + unknown) }
Changes the Actor's behavior to become the new 'Receive' (PartialFunction[Any, Unit]) handler.
Changes the Actor's behavior to become the new 'Receive' (PartialFunction[Any, Unit]) handler. Puts the behavior on top of the hotswap stack. If "discardOld" is true, an unbecome will be issued prior to pushing the new behavior to the stack
Is the actor able to handle the message passed in as arguments?
User overridable callback.
User overridable callback.
Is called right AFTER restart on the newly created Actor to allow reinitialization after an Actor crash.
User overridable callback.
User overridable callback.
Is called when 'actor.stop()' is invoked.
User overridable callback.
User overridable callback.
Is called on a crashed Actor right BEFORE it is restarted to allow clean up of resources before Actor is terminated.
User overridable callback.
User overridable callback.
Is called when an Actor is started by invoking 'actor.start()'.
The 'self' field holds the ActorRef for this actor.
The 'self' field holds the ActorRef for this actor.
Can be used to send messages to itself:
self ! messageHere you also find most of the Actor API.
For example fields like:
self.dispatcher = ... self.trapExit = ... self.faultHandler = ... self.lifeCycle = ... self.sender
Here you also find methods like:
self.reply(..) self.link(..) self.unlink(..) self.start(..) self.stop(..)
Reverts the Actor behavior to the previous one in the hotswap stack.
User overridable callback.
User overridable callback.
Is called when a message isn't handled by the current behavior of the actor by default it throws an UnhandledMessageException
Actor base trait that should be extended by or mixed to create an Actor with the semantics of the 'Actor Model': http://en.wikipedia.org/wiki/Actor_model
An actor has a well-defined (non-cyclic) life-cycle.
The Actor's API is available in the 'self' member variable.
Here you find functions like:
Here you also find fields like
This means that to use them you have to prefix them with 'self', like this: self ! Message
However, for convenience you can import these functions and fields like below, which will allow you do drop the 'self' prefix: