Mercurial > hg > Members > anatofuz > akka-increment-sample
view src/main/scala/IncrementSample.scala @ 0:29ce0c93593f
init mercurial
author | Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 29 Jan 2018 15:06:04 +0900 |
parents | |
children | 2a754f9be68f |
line wrap: on
line source
package IncrementSample import akka.actor.{Actor, ActorRef, ActorSystem, Props} object Incrementer { def props: Props = Props[Incrementer] // final case class IncrementAndSend(data:Int, otherActor: ActorRef) case object Print } class Incrementer(printerActor: ActorRef) extends Actor { import Incrementer._ /* def IncrementAndSend = { case IncrementAndSend(data,otherActor) => otherActor ! IncrementAndSend(data,self) } */ def receive = { case IntData(data) => incrementData(data) } } object IncrementSample extends App { import Incrementer._ val system: ActorSystem = ActorSystem("incrementSample") val object1 :ActorRef = system.actorOf(Incrementer.props,"incrementActor") }