Package akka.actor.typed
Class SpawnProtocol
- java.lang.Object
-
- akka.actor.typed.SpawnProtocol
-
- Direct Known Subclasses:
SpawnProtocol.Spawn
public abstract class SpawnProtocol extends java.lang.Object
A message protocol for actors that support spawning a child actor when receiving aSpawnProtocol#Spawn
message and sending back theActorRef
of the child actor. An implementation of a behavior for this protocol is defined inbehavior()
. That can be used as is or composed with other behavior usingBehavior.orElse(akka.actor.typed.Behavior<T>)
.The typical usage of this is to use it as the guardian actor of the
ActorSystem
, possibly combined withBehaviors.setup
to starts some initial tasks or actors. Child actors can then be started from the outside by telling or askingSpawnProtocol#Spawn
to the actor reference of the system. When usingask
this is similar to howActorRefFactory.actorOf(akka.actor.Props)
can be used in untyped actors with the difference that aFuture
/CompletionStage
of theActorRef
is returned.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SpawnProtocol.Spawn<T>
static class
SpawnProtocol.Spawn$
-
Constructor Summary
Constructors Constructor Description SpawnProtocol()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Behavior<SpawnProtocol>
behavior()
-
-
-
Method Detail
-
behavior
public static Behavior<SpawnProtocol> behavior()
-
-