move code to src/test
* so that it compiles and tests pass * fix some additional snip references in getting started
This commit is contained in:
parent
413df8e0f4
commit
59f53e1a22
289 changed files with 45 additions and 45 deletions
|
|
@ -78,7 +78,7 @@ convenient terminology, and we will stick to it.
|
|||
Creating a non-top-level actor is possible from any actor, by invoking `context.actorOf()` which has the exact same
|
||||
signature as its top-level counterpart. This is how it looks like in practice:
|
||||
|
||||
@@snip [Hello.scala](../../../../test/scala/tutorial_1/ActorHierarchyExperiments.scala) { #print-refs }
|
||||
@@snip [Hello.scala]($code$/scala/tutorial_1/ActorHierarchyExperiments.scala) { #print-refs }
|
||||
|
||||
We see that the following two lines are printed
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ The actor API exposes many lifecycle hooks that the actor implementation can ove
|
|||
|
||||
Again, we can try out all this with a simple experiment:
|
||||
|
||||
@@snip [Hello.scala](../../../../test/scala/tutorial_1/ActorHierarchyExperiments.scala) { #start-stop }
|
||||
@@snip [Hello.scala]($code$/scala/tutorial_1/ActorHierarchyExperiments.scala) { #start-stop }
|
||||
|
||||
After running it, we get the output
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ to the parent, which decides how to handle the exception caused by the child act
|
|||
stop and restart the child. If you don't change the default strategy all failures result in a restart. We won't change
|
||||
the default strategy in this simple experiment:
|
||||
|
||||
@@snip [Hello.scala](../../../../test/scala/tutorial_1/ActorHierarchyExperiments.scala) { #supervise }
|
||||
@@snip [Hello.scala]($code$/scala/tutorial_1/ActorHierarchyExperiments.scala) { #supervise }
|
||||
|
||||
After running the snippet, we see the following output on the console:
|
||||
|
||||
|
|
@ -211,11 +211,11 @@ The first actor happens to be rather simple now, as we have not implemented any
|
|||
is that we have dropped using `println()` and instead use the `ActorLogging` helper trait which allows us to use the
|
||||
logging facility built into Akka directly. Furthermore, we are using a recommended creational pattern for actors; define a `props()` method in the [companion object](http://docs.scala-lang.org/tutorials/tour/singleton-objects.html#companions) of the actor:
|
||||
|
||||
@@snip [Hello.scala](../../../../test/scala/tutorial_1/IotSupervisor.scala) { #iot-supervisor }
|
||||
@@snip [Hello.scala]($code$/scala/tutorial_1/IotSupervisor.scala) { #iot-supervisor }
|
||||
|
||||
All we need now is to tie this up with a class with the `main` entry point:
|
||||
|
||||
@@snip [Hello.scala](../../../../test/scala/tutorial_1/IotApp.scala) { #iot-app }
|
||||
@@snip [Hello.scala]($code$/scala/tutorial_1/IotApp.scala) { #iot-app }
|
||||
|
||||
This application does very little for now, but we have the first actor in place and we are ready to extend it further.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue