Class Adapter
- java.lang.Object
-
- org.apache.pekko.actor.typed.javadsl.Adapter
-
public class Adapter extends java.lang.ObjectAdapters between typed and classic actors and actor systems. The underlyingActorSystemis the classicpekko.actor.ActorSystemwhich runs Akkapekko.actor.typed.Behavioron 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.
watchis also supported in both directions.There are also converters (
toTyped,toClassic) between classicpekko.actor.ActorRefandpekko.actor.typed.ActorRef, and between classicpekko.actor.ActorSystemandpekko.actor.typed.ActorSystem.
-
-
Constructor Summary
Constructors Constructor Description Adapter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ActorRefactorOf(ActorContext<?> ctx, Props props)static ActorRefactorOf(ActorContext<?> ctx, Props props, java.lang.String name)static <T> Propsprops(Creator<Behavior<T>> behavior)Wrappekko.actor.typed.Behaviorin a classicpekko.actor.Props, i.e.static <T> Propsprops(Creator<Behavior<T>> behavior, Props deploy)Wrappekko.actor.typed.Behaviorin a classicpekko.actor.Props, i.e.static <T> ActorRef<T>spawn(ActorContext ctx, Behavior<T> behavior, java.lang.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, java.lang.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, java.lang.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, java.lang.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 ActorReftoClassic(ActorRef<?> ref)static ActorSystemtoClassic(ActorSystem<?> sys)static ActorContexttoClassic(ActorContext<?> ctx)static SchedulertoClassic(Scheduler scheduler)static <T> ActorRef<T>toTyped(ActorRef ref)static ActorSystem<java.lang.Void>toTyped(ActorSystem sys)static <T> SchedulertoTyped(Scheduler scheduler)static <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)
-
-
-
Method Detail
-
spawnAnonymous
public 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. Actor default supervision strategy is to stop. Can be overridden withBehaviors.supervise.
-
spawnAnonymous
public 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. Actor default supervision strategy is to stop. Can be overridden withBehaviors.supervise.
-
spawn
public static <T> ActorRef<T> spawn(ActorSystem sys, Behavior<T> behavior, java.lang.String name)
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, java.lang.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
public 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. Actor default supervision strategy is to stop. Can be overridden withBehaviors.supervise.
-
spawnAnonymous
public 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. Actor default supervision strategy is to stop. Can be overridden withBehaviors.supervise.
-
spawn
public static <T> ActorRef<T> spawn(ActorContext ctx, Behavior<T> behavior, java.lang.String name)
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, java.lang.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
public static ActorSystem<java.lang.Void> toTyped(ActorSystem sys)
-
toClassic
public static ActorSystem toClassic(ActorSystem<?> sys)
-
toClassic
public static ActorContext toClassic(ActorContext<?> ctx)
-
watch
public static <U> void watch(ActorContext ctx, ActorRef<U> other)
-
unwatch
public static <U> void unwatch(ActorContext ctx, ActorRef<U> other)
-
stop
public static void stop(ActorContext ctx, ActorRef<?> child)
-
watch
public static <U> void watch(ActorContext<?> ctx, ActorRef other)
-
unwatch
public static <U> void unwatch(ActorContext<?> ctx, ActorRef other)
-
stop
public static void stop(ActorContext<?> ctx, ActorRef child)
-
actorOf
public static ActorRef actorOf(ActorContext<?> ctx, Props props)
-
actorOf
public static ActorRef actorOf(ActorContext<?> ctx, Props props, java.lang.String name)
-
props
public static <T> Props props(Creator<Behavior<T>> behavior, Props deploy)
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
public static <T> Props props(Creator<Behavior<T>> behavior)
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.
-
-