Use RoutedProps to configure Routing (local and remote). Ticket #1060

This commit is contained in:
Peter Veentjer 2011-08-27 08:10:25 +03:00
parent b121da7d2b
commit ee4d241ceb
12 changed files with 345 additions and 139 deletions

View file

@ -5,11 +5,11 @@
package akka.tutorial.second
import akka.actor.Actor._
import akka.routing.Routing
import akka.event.EventHandler
import System.{ currentTimeMillis now }
import akka.routing.Routing.Broadcast
import akka.actor.{ Timeout, Channel, Actor, PoisonPill }
import akka.routing.{RoutedProps, Routing}
object Pi extends App {
@ -53,7 +53,13 @@ object Pi extends App {
val workers = Vector.fill(nrOfWorkers)(actorOf[Worker].start())
// wrap them with a load-balancing router
val router = Routing.actorOfWithRoundRobin("pi", workers)
val router = Routing.actorOf(
RoutedProps.apply()
.withConnections(workers)
.withRoundRobinRouter()
.withDeployId("pi")
)
// phase 1, can accept a Calculate message
def scatter: Receive = {