Creating a BalancingPool of actors
A BalancingPool tries to redistribute the work among the actors for performance improvement. In the BalancingPool, all actors share the same mailbox.
Getting ready
Just import the Hello-Akka project in the IDE; other prerequisites are the same as before.
How to do it...
- Create a Scala file,
Balancingpool.scala, in the packagecom.packt.chapter3. - Add the following imports at the top of the file:
     import akka.actor.{Props, ActorSystem, Actor}
    import akka.routing.BalancingPool - Define a simple actor as an example:
      class BalancingPoolActor extends Actor {
      override def receive = {
      case msg: String => println(s" I am ${self.path.name}")
      case _ => println(s" I don't understand the message")
      ..}
      } - Create a simple test application as follows:
       object balancingpool extends App {
      val actorSystem = ActorSystem("Hello-Akka")
      val router =
       actorSystem.actorOf...