Creating a RoundRobinPool of actors
In this recipe, you will learn how to create a RoundRobinPool
for actors. A RoundRobinPool
is a group of the same type of actors and resembles the property whereby messages are delivered one by one to all the actors in the loop. In RoundRobinPool
, all the actors share the same mailbox.
Getting ready
To step through this recipe, you will have to import the Hello-Akka
project in the IDE.
How to do it...
- Create a Scala file,
RoundRobin.scala
, in the packagecom.packt.chapter3
. - Add the following imports to the top of the file:
       import akka.actor.{Props, ActorSystem, Actor}       import akka.routing.RoundRobinPool
- Let's define an actor as follows:
       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")       }       }
Â
- Let's create a test application:
       object RoundRobinPoolApp...