May 2017
Intermediate to advanced
414 pages
13h
English
import akka.actor.{Props, ActorSystem, Actor} import akka.routing.RoundRobinPool
class RoundRobinPoolActor extends Actor { override def receive = { case msg: String => println(s" I am ${self.path.name}") case _ => println(s" I don't understand the message") } }
object RoundRobinPoolApp extends App { val actorSystem = ActorSystem("Hello-Akka") val router = actorSystem.actorOf(RoundRobinPool(5).props (Props[RoundRobinPoolActor])) for (i <- 1 to 5) { router ! s"Hello $i" } }
Read now
Unlock full access