Updated code after feedback; the actual ActorRef's are returned instead of the name of them. See #1495

This commit is contained in:
Henrik Engstrom 2011-12-19 16:35:35 +01:00
parent 3ff779cabd
commit 5aa4784ea2
2 changed files with 7 additions and 6 deletions

View file

@ -73,9 +73,9 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout with ImplicitSender {
def receive = { def receive = {
case RouterRoutees(iterable) case RouterRoutees(iterable)
iterable.exists(_ == "routee1") must be(true) iterable.exists(_.path.name == "routee1") must be(true)
iterable.exists(_ == "routee2") must be(true) iterable.exists(_.path.name == "routee2") must be(true)
iterable.exists(_ == "routee3") must be(false) iterable.exists(_.path.name == "routee3") must be(false)
doneLatch.countDown() doneLatch.countDown()
case "doIt" case "doIt"
router ! CurrentRoutees router ! CurrentRoutees

View file

@ -30,7 +30,7 @@ private[akka] class RoutedActorRef(_system: ActorSystemImpl, _props: Props, _sup
case _: AutoReceivedMessage Nil case _: AutoReceivedMessage Nil
case Terminated(_) Nil case Terminated(_) Nil
case CurrentRoutees case CurrentRoutees
sender ! RouterRoutees(_routees map (_.path.name)) sender ! RouterRoutees(_routees)
Nil Nil
case _ case _
if (route.isDefinedAt(sender, message)) route(sender, message) if (route.isDefinedAt(sender, message)) route(sender, message)
@ -149,14 +149,15 @@ case class Broadcast(message: Any)
/** /**
* Sending this message to a router will make it send back its currently used routees. * Sending this message to a router will make it send back its currently used routees.
* The routees will be sent as a RouterRoutees message to the "requester". * A RouterRoutees message is sent asynchronously to the "requester" containing information
* about what routees the router is routing over.
*/ */
case object CurrentRoutees case object CurrentRoutees
/** /**
* Message used to carry information about what routees the router is currently using. * Message used to carry information about what routees the router is currently using.
*/ */
case class RouterRoutees(routees: Iterable[String]) case class RouterRoutees(routees: Iterable[ActorRef])
/** /**
* For every message sent to a router, its route determines a set of destinations, * For every message sent to a router, its route determines a set of destinations,