Skip to content

Instantly share code, notes, and snippets.

@syuhei176
Created June 27, 2017 14:32
Show Gist options
  • Save syuhei176/19875a3aaa1c7afedb8916e3619cb12e to your computer and use it in GitHub Desktop.
Save syuhei176/19875a3aaa1c7afedb8916e3619cb12e to your computer and use it in GitHub Desktop.
import akka.actor.{ ActorSystem, Actor, ActorRef, Props, PoisonPill }
class HelloActor extends Actor {
def receive = {
case i:Int => println("Int=" + i)
case msg => {
println(msg + " by MyAkkaActor")
sender() ! ("Hello," + msg.toString)
}
}
}
object Main extends App {
val system = ActorSystem("helloworld")
val helloActor = system.actorOf(Props[HelloActor], "hello")
val result1 = helloActor ! 100
val result2 = helloActor ! "World"
println("result1 = " + result1)
println("result2 = " + result1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment