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
User overridable callback.
User overridable callback.
Is called on the crashed Actor to give it the option of producing the Actor's reincarnation. If it returns None, which is the default, the initially provided actor factory is used.
Warning: Propagating state from a crashed actor carries the risk of proliferating the cause of the error. Consider let-it-crash first.
Is the actor able to handle the message passed in as arguments?
Option[ActorRef] representation of the 'self' ActorRef reference.
Option[ActorRef] representation of the 'self' ActorRef reference.
Mainly for internal use, functions as the implicit sender references when invoking one of the message send functions ('!', '!!' and '!!!').
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. Override either the variant with or without the currentMessage argument.
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(..)
Some[ActorRef] representation of the 'self' ActorRef reference.
Some[ActorRef] representation of the 'self' ActorRef reference.
Mainly for internal use, functions as the implicit sender references when invoking the 'forward' function.
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
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. Override either the variant with or without the currentMessage argument.
This method is deprecated: use the variant which receives the current message instead. This method will be removed in version 2.0.
use two-argument version, this one will be removed in 2.0
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: