Adding docs about creating TypedActor children

This commit is contained in:
Viktor Klang 2012-05-25 00:49:45 +02:00
parent 681ccc6153
commit fdd4a85ab0
6 changed files with 42 additions and 6 deletions

View file

@ -5,6 +5,7 @@ package docs.actor;
//#imports
import akka.actor.TypedActor;
import akka.dispatch.*;
import akka.actor.*;
import akka.japi.*;
@ -151,6 +152,21 @@ public class TypedActorDocTestBase {
}
}
@Test public void createHierarchies() {
try {
//#typed-actor-hierarchy
Squarer childSquarer =
TypedActor.get(TypedActor.context()).
typedActorOf(
new TypedProps<SquarerImpl>(Squarer.class, SquarerImpl.class)
);
//Use "childSquarer" as a Squarer
//#typed-actor-hierarchy
} catch (Exception e) {
//dun care
}
}
@Test public void proxyAnyActorRef() {
try {
//#typed-actor-remote

View file

@ -163,7 +163,11 @@ Typed Actor Hierarchies
Since you can obtain a contextual Typed Actor Extension by passing in an ``ActorContext``
you can create child Typed Actors by invoking ``typedActorOf(..)`` on that.
This also works for creating child Typed Actors in regular Akka Actors.
.. includecode:: code/akka/docs/actor/TypedActorDocTestBase.java
:include: typed-actor-hierarchy
You can also create a child Typed Actor in regular Akka Actors by giving the ``UntypedActorContext``
as an input parameter to TypedActor.get(…).
Supervisor Strategy
-------------------
@ -204,4 +208,4 @@ 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/docs/actor/TypedActorDocTestBase.java#typed-actor-remote
.. includecode:: code/docs/actor/TypedActorDocTestBase.java#typed-actor-remote