Merge pull request #220 from jboner/wip-1606-remote-routers-patriknw

Handle remote routers transparently
This commit is contained in:
patriknw 2012-01-17 06:56:42 -08:00
commit 2e6061b411
10 changed files with 242 additions and 273 deletions

View file

@ -16,6 +16,7 @@ object RemoteRouterSpec {
}
}
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
class RemoteRouterSpec extends AkkaSpec("""
akka {
actor.provider = "akka.remote.RemoteActorRefProvider"
@ -25,10 +26,18 @@ akka {
}
actor.deployment {
/blub {
router = "round-robin"
router = round-robin
nr-of-instances = 2
target.nodes = ["akka://remote_sys@localhost:12346"]
}
/elastic-blub {
router = round-robin
resizer {
lower-bound = 2
upper-bound = 3
}
target.nodes = ["akka://remote_sys@localhost:12346"]
}
}
}
""") with ImplicitSender {
@ -52,6 +61,23 @@ akka {
expectMsgType[ActorPath].toString must be === "akka://remote_sys@localhost:12346/remote/RemoteRouterSpec@localhost:12345/user/blub/c2"
}
"deploy its children on remote host driven by programatic definition" in {
val router = system.actorOf(Props[Echo].withRouter(new RemoteRouterConfig(RoundRobinRouter(2),
Seq("akka://remote_sys@localhost:12346"))), "blub2")
router ! ""
expectMsgType[ActorPath].toString must be === "akka://remote_sys@localhost:12346/remote/RemoteRouterSpec@localhost:12345/user/blub2/c1"
router ! ""
expectMsgType[ActorPath].toString must be === "akka://remote_sys@localhost:12346/remote/RemoteRouterSpec@localhost:12345/user/blub2/c2"
}
"deploy dynamic resizable number of children on remote host driven by configuration" in {
val router = system.actorOf(Props[Echo].withRouter(FromConfig), "elastic-blub")
router ! ""
expectMsgType[ActorPath].toString must be === "akka://remote_sys@localhost:12346/remote/RemoteRouterSpec@localhost:12345/user/elastic-blub/c1"
router ! ""
expectMsgType[ActorPath].toString must be === "akka://remote_sys@localhost:12346/remote/RemoteRouterSpec@localhost:12345/user/elastic-blub/c2"
}
}
}