Class Adapter
java.lang.Object
org.apache.pekko.actor.typed.javadsl.Adapter
Adapters between typed and classic actors and actor systems.
The underlying
ActorSystem is the classic pekko.actor.ActorSystem
which runs Akka pekko.actor.typed.Behavior on an emulation layer. In this
system typed and classic actors can coexist.
These methods make it possible to create a child actor from classic
parent actor, and the opposite classic child from typed parent.
watch is also supported in both directions.
There are also converters (toTyped, toClassic) between classic
pekko.actor.ActorRef and pekko.actor.typed.ActorRef, and between classic
pekko.actor.ActorSystem and pekko.actor.typed.ActorSystem.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ActorRefactorOf(ActorContext<?> ctx, Props props) static ActorRefactorOf(ActorContext<?> ctx, Props props, String name) static <T> PropsWrappekko.actor.typed.Behaviorin a classicpekko.actor.Props, i.e.static <T> PropsWrappekko.actor.typed.Behaviorin a classicpekko.actor.Props, i.e.static <T> ActorRef<T>spawn(ActorContext ctx, Behavior<T> behavior, String name) Spawn the given behavior as a child of the user actor in a classic ActorContext.static <T> ActorRef<T>spawn(ActorContext ctx, Behavior<T> behavior, String name, Props props) Spawn the given behavior as a child of the user actor in a classic ActorContext.static <T> ActorRef<T>spawn(ActorSystem sys, Behavior<T> behavior, String name) Spawn the given behavior as a child of the user actor in a classic ActorSystem.static <T> ActorRef<T>spawn(ActorSystem sys, Behavior<T> behavior, String name, Props props) Spawn the given behavior as a child of the user actor in a classic ActorSystem.static <T> ActorRef<T>spawnAnonymous(ActorContext ctx, Behavior<T> behavior) Spawn the given behavior as a child of the user actor in a classic ActorContext.static <T> ActorRef<T>spawnAnonymous(ActorContext ctx, Behavior<T> behavior, Props props) Spawn the given behavior as a child of the user actor in a classic ActorContext.static <T> ActorRef<T>spawnAnonymous(ActorSystem sys, Behavior<T> behavior) Spawn the given behavior as a child of the user actor in a classic ActorSystem.static <T> ActorRef<T>spawnAnonymous(ActorSystem sys, Behavior<T> behavior, Props props) Spawn the given behavior as a child of the user actor in a classic ActorSystem.static voidstop(ActorContext ctx, ActorRef<?> child) static voidstop(ActorContext<?> ctx, ActorRef child) static ActorRefstatic ActorSystemtoClassic(ActorSystem<?> sys) static ActorContexttoClassic(ActorContext<?> ctx) static Schedulerstatic <T> ActorRef<T>static ActorSystem<Void>toTyped(ActorSystem sys) static <T> Schedulerstatic <U> voidunwatch(ActorContext ctx, ActorRef<U> other) static <U> voidunwatch(ActorContext<?> ctx, ActorRef other) static <U> voidwatch(ActorContext ctx, ActorRef<U> other) static <U> voidwatch(ActorContext<?> ctx, ActorRef other)
-
Constructor Details
-
Adapter
public Adapter()
-
-
Method Details
-
spawnAnonymous
Spawn the given behavior as a child of the user actor in a classic ActorSystem. Actor default supervision strategy is to stop. Can be overridden withBehaviors.supervise. -
spawnAnonymous
Spawn the given behavior as a child of the user actor in a classic ActorSystem. Actor default supervision strategy is to stop. Can be overridden withBehaviors.supervise. -
spawn
Spawn the given behavior as a child of the user actor in a classic ActorSystem. Actor default supervision strategy is to stop. Can be overridden withBehaviors.supervise. -
spawn
public static <T> ActorRef<T> spawn(ActorSystem sys, Behavior<T> behavior, String name, Props props) Spawn the given behavior as a child of the user actor in a classic ActorSystem. Actor default supervision strategy is to stop. Can be overridden withBehaviors.supervise. -
spawnAnonymous
Spawn the given behavior as a child of the user actor in a classic ActorContext. Actor default supervision strategy is to stop. Can be overridden withBehaviors.supervise. -
spawnAnonymous
Spawn the given behavior as a child of the user actor in a classic ActorContext. Actor default supervision strategy is to stop. Can be overridden withBehaviors.supervise. -
spawn
Spawn the given behavior as a child of the user actor in a classic ActorContext. Actor default supervision strategy is to stop. Can be overridden withBehaviors.supervise. -
spawn
public static <T> ActorRef<T> spawn(ActorContext ctx, Behavior<T> behavior, String name, Props props) Spawn the given behavior as a child of the user actor in a classic ActorContext. Actor default supervision strategy is to stop. Can be overridden withBehaviors.supervise. -
toTyped
-
toClassic
-
toClassic
-
watch
-
unwatch
-
stop
-
watch
-
unwatch
-
stop
-
actorOf
-
actorOf
-
toClassic
-
toTyped
-
props
Wrappekko.actor.typed.Behaviorin a classicpekko.actor.Props, i.e. when spawning a typed child actor from a classic parent actor. This is normally not needed because you can use the extension methodsspawnandspawnAnonymouswith a classicActorContext, but it's needed when using typed actors with an existing library/tool that provides an API that takes a classicpekko.actor.Propsparameter. Cluster Sharding is an example of that. -
props
Wrappekko.actor.typed.Behaviorin a classicpekko.actor.Props, i.e. when spawning a typed child actor from a classic parent actor. This is normally not needed because you can use the extension methodsspawnandspawnAnonymouswith a classicActorContext, but it's needed when using typed actors with an existing library/tool that provides an API that takes a classicpekko.actor.Propsparameter. Cluster Sharding is an example of that. -
toClassic
-
toTyped
-