benjaminBoboul/workbench-getting-started-with-scala

View on GitHub
src/main/scala/akkaActor/router/AutomaticRouter.scala

Summary

Maintainability
A
0 mins
Test Coverage
package akkaActor.router

import akka.actor.{Actor, ActorLogging, ActorSystem, Props}
import akka.routing.RoundRobinPool

object AutomaticRouter extends App {
  import manualRouter.Slave
  val system = ActorSystem("MySystem")

  val poolMaster = system.actorOf(RoundRobinPool(5).props(Props[Slave]()), "simplePool")
  for (index <- 1 to 10) {
    poolMaster ! s"$index Hello, world!"
  }

  system.terminate()
}