rewrite quickstart page, #22900

This commit is contained in:
Patrik Nordwall 2017-05-12 13:43:33 +02:00
parent 4cb9c2436f
commit 68aeba1cb7
4 changed files with 13 additions and 200 deletions

View file

@ -1,16 +0,0 @@
package jdocs.quickstart;
import akka.actor.AbstractActor;
import akka.actor.AbstractActor.Receive;
//#actor-impl
public class HelloWorldActor extends AbstractActor {
public Receive createReceive() {
return receiveBuilder()
.match(String.class, msg -> {
System.out.println("Hello " + msg);
})
.build();
}
}
//#actor-impl

View file

@ -1,29 +0,0 @@
//#full-example
package jdocs.quickstart;
import java.io.IOException;
import akka.actor.ActorRef;
import akka.actor.Props;
import akka.actor.ActorSystem;
public class HelloWorldMain {
public static void main(String[] args) throws IOException {
//#create-send
ActorSystem system = ActorSystem.create("hello-world-actor-system");
try {
// Create hello world actor
ActorRef helloWorldActor = system.actorOf(Props.create(HelloWorldActor.class), "HelloWorldActor");
// Send message to actor
helloWorldActor.tell("World", ActorRef.noSender());
System.out.println("Press ENTER to exit the system");
System.in.read();
} finally {
system.terminate();
}
//#create-send
}
}
//#full-example