diff --git a/akka-docs/java/code/akka/docs/actor/TypedActorDocTestBase.java b/akka-docs/java/code/akka/docs/actor/TypedActorDocTestBase.java index 72f950e2e7..30db92ee0f 100644 --- a/akka-docs/java/code/akka/docs/actor/TypedActorDocTestBase.java +++ b/akka-docs/java/code/akka/docs/actor/TypedActorDocTestBase.java @@ -150,4 +150,20 @@ public class TypedActorDocTestBase { //Ignore } } + + @Test public void proxyAnyActorRef() { + try { + //#typed-actor-remote + Squarer typedActor = + TypedActor.get(system). + typedActorOf( + new TypedProps(Squarer.class), + system.actorFor("akka://SomeSystem@somehost:2552/user/some/foobar") + ); + //Use "typedActor" as a FooBar + //#typed-actor-remote + } catch (Exception e) { + //dun care + } + } } diff --git a/akka-docs/java/typed-actors.rst b/akka-docs/java/typed-actors.rst index c1de57c396..b2d7a9bfae 100644 --- a/akka-docs/java/typed-actors.rst +++ b/akka-docs/java/typed-actors.rst @@ -198,3 +198,10 @@ Proxying You can use the ``typedActorOf`` that takes a TypedProps and an ActorRef to proxy the given ActorRef as a TypedActor. This is usable if you want to communicate remotely with TypedActors on other machines, just look them up with ``actorFor`` and pass the ``ActorRef`` to ``typedActorOf``. + +Lookup & Remoting +----------------- + +Since ``TypedActors`` are backed by ``Akka Actors``, you can use ``actorFor`` together with ``typedActorOf`` to proxy ``ActorRefs`` potentially residing on remote nodes. + +.. includecode:: code/akka/docs/actor/TypedActorDocTestBase.java#typed-actor-remote \ No newline at end of file diff --git a/akka-docs/scala/code/akka/docs/actor/TypedActorDocSpec.scala b/akka-docs/scala/code/akka/docs/actor/TypedActorDocSpec.scala index b1fcc9224c..f7c5fa9bf7 100644 --- a/akka-docs/scala/code/akka/docs/actor/TypedActorDocSpec.scala +++ b/akka-docs/scala/code/akka/docs/actor/TypedActorDocSpec.scala @@ -140,6 +140,17 @@ class TypedActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) { //#typed-actor-poisonpill } + "proxy any ActorRef" in { + //#typed-actor-remote + val typedActor: Foo with Bar = + TypedActor(system). + typedActorOf( + TypedProps[FooBar], + system.actorFor("akka://SomeSystem@somehost:2552/user/some/foobar")) + //Use "typedActor" as a FooBar + //#typed-actor-remote + } + "supercharge" in { //#typed-actor-supercharge-usage val awesomeFooBar: Foo with Bar = TypedActor(system).typedActorOf(TypedProps[FooBar]()) diff --git a/akka-docs/scala/typed-actors.rst b/akka-docs/scala/typed-actors.rst index 8db250fec1..fc570e60a7 100644 --- a/akka-docs/scala/typed-actors.rst +++ b/akka-docs/scala/typed-actors.rst @@ -203,6 +203,13 @@ This is usable if you want to communicate remotely with TypedActors on other mac The ActorRef needs to accept ``MethodCall`` messages. +Lookup & Remoting +----------------- + +Since ``TypedActors`` are backed by ``Akka Actors``, you can use ``actorFor`` together with ``typedActorOf`` to proxy ``ActorRefs`` potentially residing on remote nodes. + +.. includecode:: code/akka/docs/actor/TypedActorDocSpec.scala#typed-actor-remote + Supercharging -------------