Streamlined configuration, transport adapters and FailureInjector

- Transports no longer uses raw ActorRefs as listeners but proper interfaces.
 - Added managementCommand support to Transports
 - Added support for dynamically loadable transport adapters
 - Added throttler/failure injector transport adapter
 - added actor based adapter support
 - Changed configuration method of multiple transports - Fixed tests to work with the new remoting
This commit is contained in:
Endre Sándor Varga 2012-11-23 10:15:19 +01:00
parent 5b96c28acd
commit 0705d47a88
30 changed files with 1812 additions and 585 deletions

View file

@ -21,7 +21,7 @@ object RemoteRouterSpec {
class RemoteRouterSpec extends AkkaSpec("""
akka {
actor.provider = "akka.remote.RemoteActorRefProvider"
remote.netty {
remoting.transports.tcp {
hostname = localhost
port = 0
}
@ -29,7 +29,7 @@ akka {
/blub {
router = round-robin
nr-of-instances = 2
target.nodes = ["akka://remote-sys@localhost:12347"]
target.nodes = ["tcp.akka://remote-sys@localhost:12347"]
}
/elastic-blub {
router = round-robin
@ -37,10 +37,10 @@ akka {
lower-bound = 2
upper-bound = 3
}
target.nodes = ["akka://remote-sys@localhost:12347"]
target.nodes = ["tcp.akka://remote-sys@localhost:12347"]
}
/remote-blub {
remote = "akka://remote-sys@localhost:12347"
remote = "tcp.akka://remote-sys@localhost:12347"
router = round-robin
nr-of-instances = 2
}
@ -48,12 +48,12 @@ akka {
remote = "akka://RemoteRouterSpec"
router = round-robin
nr-of-instances = 2
target.nodes = ["akka://remote-sys@localhost:12347"]
target.nodes = ["tcp.akka://remote-sys@localhost:12347"]
}
/local-blub2 {
router = round-robin
nr-of-instances = 4
target.nodes = ["akka://remote-sys@localhost:12347"]
target.nodes = ["tcp.akka://remote-sys@localhost:12347"]
}
}
}
@ -61,7 +61,7 @@ akka {
import RemoteRouterSpec._
val conf = ConfigFactory.parseString("""akka.remote.netty.port=12347
val conf = ConfigFactory.parseString("""akka.remoting.transports.tcp.port=12347
akka.actor.deployment {
/remote-override {
router = round-robin
@ -85,13 +85,13 @@ akka.actor.deployment {
val children = replies.toSet
children must have size 2
children.map(_.parent) must have size 1
children foreach (_.address.toString must be === "akka://remote-sys@localhost:12347")
children foreach (_.address.toString must be === "tcp.akka://remote-sys@localhost:12347")
system.stop(router)
}
"deploy its children on remote host driven by programatic definition" in {
val router = system.actorOf(Props[Echo].withRouter(new RemoteRouterConfig(RoundRobinRouter(2),
Seq(Address("akka", "remote-sys", "localhost", 12347)))), "blub2")
Seq(Address("tcp.akka", "remote-sys", "localhost", 12347)))), "blub2")
val replies = for (i 1 to 5) yield {
router ! ""
expectMsgType[ActorRef].path
@ -99,7 +99,7 @@ akka.actor.deployment {
val children = replies.toSet
children must have size 2
children.map(_.parent) must have size 1
children foreach (_.address.toString must be === "akka://remote-sys@localhost:12347")
children foreach (_.address.toString must be === "tcp.akka://remote-sys@localhost:12347")
system.stop(router)
}
@ -112,13 +112,13 @@ akka.actor.deployment {
val children = replies.toSet
children.size must be >= 2
children.map(_.parent) must have size 1
children foreach (_.address.toString must be === "akka://remote-sys@localhost:12347")
children foreach (_.address.toString must be === "tcp.akka://remote-sys@localhost:12347")
system.stop(router)
}
"deploy remote routers based on configuration" in {
val router = system.actorOf(Props[Echo].withRouter(FromConfig), "remote-blub")
router.path.address.toString must be("akka://remote-sys@localhost:12347")
router.path.address.toString must be("tcp.akka://remote-sys@localhost:12347")
val replies = for (i 1 to 5) yield {
router ! ""
expectMsgType[ActorRef].path
@ -128,14 +128,14 @@ akka.actor.deployment {
val parents = children.map(_.parent)
parents must have size 1
parents.head must be(router.path)
children foreach (_.address.toString must be === "akka://remote-sys@localhost:12347")
children foreach (_.address.toString must be === "tcp.akka://remote-sys@localhost:12347")
system.stop(router)
}
"deploy remote routers based on explicit deployment" in {
val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(2))
.withDeploy(Deploy(scope = RemoteScope(AddressFromURIString("akka://remote-sys@localhost:12347")))), "remote-blub2")
router.path.address.toString must be("akka://remote-sys@localhost:12347")
.withDeploy(Deploy(scope = RemoteScope(AddressFromURIString("tcp.akka://remote-sys@localhost:12347")))), "remote-blub2")
router.path.address.toString must be("tcp.akka://remote-sys@localhost:12347")
val replies = for (i 1 to 5) yield {
router ! ""
expectMsgType[ActorRef].path
@ -145,13 +145,13 @@ akka.actor.deployment {
val parents = children.map(_.parent)
parents must have size 1
parents.head must be(router.path)
children foreach (_.address.toString must be === "akka://remote-sys@localhost:12347")
children foreach (_.address.toString must be === "tcp.akka://remote-sys@localhost:12347")
system.stop(router)
}
"let remote deployment be overridden by local configuration" in {
val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(2))
.withDeploy(Deploy(scope = RemoteScope(AddressFromURIString("akka://remote-sys@localhost:12347")))), "local-blub")
.withDeploy(Deploy(scope = RemoteScope(AddressFromURIString("tcp.akka://remote-sys@localhost:12347")))), "local-blub")
router.path.address.toString must be("akka://RemoteRouterSpec")
val replies = for (i 1 to 5) yield {
router ! ""
@ -161,15 +161,15 @@ akka.actor.deployment {
children must have size 2
val parents = children.map(_.parent)
parents must have size 1
parents.head.address must be(Address("akka", "remote-sys", "localhost", 12347))
children foreach (_.address.toString must be === "akka://remote-sys@localhost:12347")
parents.head.address must be(Address("tcp.akka", "remote-sys", "localhost", 12347))
children foreach (_.address.toString must be === "tcp.akka://remote-sys@localhost:12347")
system.stop(router)
}
"let remote deployment router be overridden by local configuration" in {
val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(2))
.withDeploy(Deploy(scope = RemoteScope(AddressFromURIString("akka://remote-sys@localhost:12347")))), "local-blub2")
router.path.address.toString must be("akka://remote-sys@localhost:12347")
.withDeploy(Deploy(scope = RemoteScope(AddressFromURIString("tcp.akka://remote-sys@localhost:12347")))), "local-blub2")
router.path.address.toString must be("tcp.akka://remote-sys@localhost:12347")
val replies = for (i 1 to 5) yield {
router ! ""
expectMsgType[ActorRef].path
@ -179,14 +179,14 @@ akka.actor.deployment {
val parents = children.map(_.parent)
parents must have size 1
parents.head must be(router.path)
children foreach (_.address.toString must be === "akka://remote-sys@localhost:12347")
children foreach (_.address.toString must be === "tcp.akka://remote-sys@localhost:12347")
system.stop(router)
}
"let remote deployment be overridden by remote configuration" in {
val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(2))
.withDeploy(Deploy(scope = RemoteScope(AddressFromURIString("akka://remote-sys@localhost:12347")))), "remote-override")
router.path.address.toString must be("akka://remote-sys@localhost:12347")
.withDeploy(Deploy(scope = RemoteScope(AddressFromURIString("tcp.akka://remote-sys@localhost:12347")))), "remote-override")
router.path.address.toString must be("tcp.akka://remote-sys@localhost:12347")
val replies = for (i 1 to 5) yield {
router ! ""
expectMsgType[ActorRef].path
@ -196,7 +196,7 @@ akka.actor.deployment {
val parents = children.map(_.parent)
parents must have size 1
parents.head must be(router.path)
children foreach (_.address.toString must be === "akka://remote-sys@localhost:12347")
children foreach (_.address.toString must be === "tcp.akka://remote-sys@localhost:12347")
system.stop(router)
}
@ -206,7 +206,7 @@ akka.actor.deployment {
}
val router = system.actorOf(Props.empty.withRouter(new RemoteRouterConfig(
RoundRobinRouter(1, supervisorStrategy = escalator),
Seq(Address("akka", "remote-sys", "localhost", 12347)))), "blub3")
Seq(Address("tcp.akka", "remote-sys", "localhost", 12347)))), "blub3")
router ! CurrentRoutees
EventFilter[ActorKilledException](occurrences = 1) intercept {