move Java code snippet into compiled class
This commit is contained in:
parent
96486428e1
commit
4e12b72959
2 changed files with 16 additions and 3 deletions
|
|
@ -68,4 +68,18 @@ public class RouterViaProgramExample {
|
|||
router3.tell(new ExampleActor.Message(i));
|
||||
}
|
||||
}
|
||||
|
||||
private class CompileCheckJavaDocsForRouting extends UntypedActor {
|
||||
|
||||
@Override
|
||||
public void onReceive(Object o) {
|
||||
//#reply-with-parent
|
||||
getSender().tell("reply", getContext().parent()); // replies go to router
|
||||
//#reply-with-parent
|
||||
//#reply-with-self
|
||||
getSender().tell("reply", getSelf()); // replies go to this actor
|
||||
//#reply-with-self
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -87,10 +87,9 @@ deterministic fashion. Since each actor knows its own external representation
|
|||
as well as that of its parent, the routees decide where replies should be sent
|
||||
when reacting to a message:
|
||||
|
||||
.. code-block:: java
|
||||
.. includecode:: code/akka/docs/jrouting/RouterViaProgramExample.java#reply-with-parent
|
||||
|
||||
getSender().tell(reply, getContext().parent()); // replies go to the router
|
||||
getSender().tell(reply, getSelf()); // replies go to this routee
|
||||
.. includecode:: code/akka/docs/jrouting/RouterViaProgramExample.java#reply-with-self
|
||||
|
||||
It is apparent now why routing needs to be enabled in code rather than being
|
||||
possible to “bolt on” later: whether or not an actor is routed means a change
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue