public class SpawnProtocol extends java.lang.ObjectA message protocol for actors that support spawning a child actor when receiving a
SpawnProtocol#Spawnmessage and sending back the
ActorRefof the child actor. Create instances through the
The typical usage of this is to use it as the guardian actor of the
ActorSystem, possibly combined with
Behaviors.setupto starts some initial tasks or actors. Child actors can then be started from the outside by telling or asking
SpawnProtocol#Spawnto the actor reference of the system. When using
askthis is similar to how
ActorRefFactory.actorOf(akka.actor.Props)can be used in classic actors with the difference that a
Stopping children is done through specific support in the protocol of the children, or stopping the entire spawn protocol actor.
Nested Class Summary
Nested Classes Modifier and Type Class Description
SpawnProtocol.CommandNot for user extension
SpawnProtocol.Spawn<T>Spawn a child actor with the given
behaviorand send back the
ActorRefof that child to the given
Constructors Constructor Description
All Methods Static Methods Concrete Methods Modifier and Type Method Description
apply()Scala API: returns a behavior that can be commanded to spawn arbitrary children.
create()Java API: returns a behavior that can be commanded to spawn arbitrary children.