add akka.Main and use that to add Hello World docs
- akka.Main will start an ActorSystem and one actor; when that actor terminates the system is shut down - HelloWorld sample with two actors
This commit is contained in:
parent
a4b485968c
commit
651f699893
11 changed files with 254 additions and 2 deletions
26
akka-docs/rst/java/code/docs/actor/japi/Greeter.java
Normal file
26
akka-docs/rst/java/code/docs/actor/japi/Greeter.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
|
||||
package docs.actor.japi;
|
||||
|
||||
import akka.actor.UntypedActor;
|
||||
import java.io.Serializable;
|
||||
|
||||
//#greeter
|
||||
public class Greeter extends UntypedActor {
|
||||
|
||||
public static enum Msg {
|
||||
GREET, DONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Object msg) {
|
||||
if (msg == Msg.GREET) {
|
||||
System.out.println("Hello World!");
|
||||
getSender().tell(Msg.DONE, getSelf());
|
||||
} else unhandled(msg);
|
||||
}
|
||||
|
||||
}
|
||||
//#greeter
|
||||
Loading…
Add table
Add a link
Reference in a new issue