Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
package sample.hello
import akka.actor.ActorSystem
import akka.actor.Props
import akka.actor.UntypedActor
import akka.actor.UntypedActorContext
import akka.actor.ActorPath
import scala.concurrent.duration.Duration
import java.util.HashMap
import akka.actor.ActorSystem
import akka.actor.ActorRef
object start {}
fun main(args: Array<String>) {
val system = ActorSystem.create();
val helloActor = system.actorOf(Props(javaClass<HelloActor>()));
helloActor.tell(start)
}
class HelloActor: UntypedActor() {
var worldActor: ActorRef = getContext().actorOf(Props(javaClass<WorldActor>()))
public override fun onReceive(msg: Any?) {
when (msg) {
start -> worldActor.tell("Hello", self())
is String-> {
println("Received message: $msg")
getContext().system().shutdown()
}
else -> unhandled(msg)
}
}
}
class WorldActor: UntypedActor() {
public override fun onReceive(msg: Any?) {
when (msg) {
is String -> getSender().tell(msg.toUpperCase() + " world");
else -> unhandled(msg);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.