Re-enable akka-kernel and add small sample

Created a new simple version of the microkernel for
inclusion in the akka download and to be able to start
working on sample applications
This commit is contained in:
Peter Vlugter 2011-12-14 16:19:16 +13:00
parent 66e7155ef1
commit ba9ed982ca
19 changed files with 247 additions and 531 deletions

View file

@ -0,0 +1,8 @@
# Config for the Hello Kernel sample
akka {
kernel {
system.name = "hellokernel"
boot = ["sample.kernel.hello.HelloKernel"]
}
}

View file

@ -0,0 +1,33 @@
/**
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
*/
package sample.kernel.hello
import akka.actor.{ Actor, ActorSystem, Props }
import akka.kernel.Bootable
case object Start
class HelloActor extends Actor {
val worldActor = context.actorOf(Props[WorldActor])
def receive = {
case Start worldActor ! "Hello"
case message: String
println("Received message '%s'" format message)
}
}
class WorldActor extends Actor {
def receive = {
case message: String sender ! (message.toUpperCase + " world!")
}
}
class HelloKernel extends Bootable {
def startup(system: ActorSystem) = {
system.actorOf(Props[HelloActor]) ! Start
}
def shutdown(system: ActorSystem) = {}
}