Class Adapter$
- java.lang.Object
-
- org.apache.pekko.actor.typed.javadsl.Adapter$
-
public class Adapter$ extends java.lang.Object
Adapters between typed and classic actors and actor systems. The underlyingActorSystem
is the classicpekko.actor.ActorSystem
which runs Akkapekko.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 classicpekko.actor.ActorRef
andpekko.actor.typed.ActorRef
, and between classicpekko.actor.ActorSystem
andpekko.actor.typed.ActorSystem
.
-
-
Constructor Summary
Constructors Constructor Description Adapter$()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActorRef
actorOf(ActorContext<?> ctx, Props props)
ActorRef
actorOf(ActorContext<?> ctx, Props props, java.lang.String name)
<T> Props
props(Creator<Behavior<T>> behavior)
Wrappekko.actor.typed.Behavior
in a classicpekko.actor.Props
, i.e.<T> Props
props(Creator<Behavior<T>> behavior, Props deploy)
Wrappekko.actor.typed.Behavior
in a classicpekko.actor.Props
, i.e.<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.<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.<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.<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.<T> ActorRef<T>
spawnAnonymous(ActorContext ctx, Behavior<T> behavior)
Spawn the given behavior as a child of the user actor in a classic ActorContext.<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.<T> ActorRef<T>
spawnAnonymous(ActorSystem sys, Behavior<T> behavior)
Spawn the given behavior as a child of the user actor in a classic ActorSystem.<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.void
stop(ActorContext ctx, ActorRef<?> child)
void
stop(ActorContext<?> ctx, ActorRef child)
ActorRef
toClassic(ActorRef<?> ref)
ActorSystem
toClassic(ActorSystem<?> sys)
ActorContext
toClassic(ActorContext<?> ctx)
Scheduler
toClassic(Scheduler scheduler)
<T> ActorRef<T>
toTyped(ActorRef ref)
ActorSystem<java.lang.Void>
toTyped(ActorSystem sys)
<T> Scheduler
toTyped(Scheduler scheduler)
<U> void
unwatch(ActorContext ctx, ActorRef<U> other)
<U> void
unwatch(ActorContext<?> ctx, ActorRef other)
<U> void
watch(ActorContext ctx, ActorRef<U> other)
<U> void
watch(ActorContext<?> ctx, ActorRef other)
-
-
-
Field Detail
-
MODULE$
public static final Adapter$ MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Method Detail
-
spawnAnonymous
public <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 <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 <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 <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 <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 <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 <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 <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 ActorSystem<java.lang.Void> toTyped(ActorSystem sys)
-
toClassic
public ActorSystem toClassic(ActorSystem<?> sys)
-
toClassic
public ActorContext toClassic(ActorContext<?> ctx)
-
watch
public <U> void watch(ActorContext ctx, ActorRef<U> other)
-
unwatch
public <U> void unwatch(ActorContext ctx, ActorRef<U> other)
-
stop
public void stop(ActorContext ctx, ActorRef<?> child)
-
watch
public <U> void watch(ActorContext<?> ctx, ActorRef other)
-
unwatch
public <U> void unwatch(ActorContext<?> ctx, ActorRef other)
-
stop
public void stop(ActorContext<?> ctx, ActorRef child)
-
actorOf
public ActorRef actorOf(ActorContext<?> ctx, Props props)
-
actorOf
public ActorRef actorOf(ActorContext<?> ctx, Props props, java.lang.String name)
-
props
public <T> Props props(Creator<Behavior<T>> behavior, Props deploy)
Wrappekko.actor.typed.Behavior
in 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 methodsspawn
andspawnAnonymous
with a classicActorContext
, but it's needed when using typed actors with an existing library/tool that provides an API that takes a classicpekko.actor.Props
parameter. Cluster Sharding is an example of that.
-
props
public <T> Props props(Creator<Behavior<T>> behavior)
Wrappekko.actor.typed.Behavior
in 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 methodsspawn
andspawnAnonymous
with a classicActorContext
, but it's needed when using typed actors with an existing library/tool that provides an API that takes a classicpekko.actor.Props
parameter. Cluster Sharding is an example of that.
-
-