Removed create-as and corresponding ActorRecipe. See #1511
This commit is contained in:
parent
e81791cbb6
commit
f01b9486aa
8 changed files with 9 additions and 46 deletions
|
|
@ -15,11 +15,6 @@ object DeployerSpec {
|
||||||
akka.actor.deployment {
|
akka.actor.deployment {
|
||||||
/service1 {
|
/service1 {
|
||||||
}
|
}
|
||||||
/service3 {
|
|
||||||
create-as {
|
|
||||||
class = "akka.actor.DeployerSpec$RecipeActor"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/service-direct {
|
/service-direct {
|
||||||
router = from-code
|
router = from-code
|
||||||
}
|
}
|
||||||
|
|
@ -68,7 +63,6 @@ class DeployerSpec extends AkkaSpec(DeployerSpec.deployerConf) {
|
||||||
Deploy(
|
Deploy(
|
||||||
service,
|
service,
|
||||||
deployment.get.config,
|
deployment.get.config,
|
||||||
None,
|
|
||||||
NoRouter,
|
NoRouter,
|
||||||
LocalScope)))
|
LocalScope)))
|
||||||
}
|
}
|
||||||
|
|
@ -79,20 +73,6 @@ class DeployerSpec extends AkkaSpec(DeployerSpec.deployerConf) {
|
||||||
deployment must be(None)
|
deployment must be(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
"be able to parse 'akka.actor.deployment._' with recipe" in {
|
|
||||||
val service = "/service3"
|
|
||||||
val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service)
|
|
||||||
deployment must be('defined)
|
|
||||||
|
|
||||||
deployment must be(Some(
|
|
||||||
Deploy(
|
|
||||||
service,
|
|
||||||
deployment.get.config,
|
|
||||||
Some(ActorRecipe(classOf[DeployerSpec.RecipeActor])),
|
|
||||||
NoRouter,
|
|
||||||
LocalScope)))
|
|
||||||
}
|
|
||||||
|
|
||||||
"detect invalid number-of-instances" in {
|
"detect invalid number-of-instances" in {
|
||||||
intercept[com.typesafe.config.ConfigException.WrongType] {
|
intercept[com.typesafe.config.ConfigException.WrongType] {
|
||||||
val invalidDeployerConf = ConfigFactory.parseString("""
|
val invalidDeployerConf = ConfigFactory.parseString("""
|
||||||
|
|
@ -137,7 +117,6 @@ class DeployerSpec extends AkkaSpec(DeployerSpec.deployerConf) {
|
||||||
val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service)
|
val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service)
|
||||||
deployment must be('defined)
|
deployment must be('defined)
|
||||||
deployment.get.path must be(service)
|
deployment.get.path must be(service)
|
||||||
deployment.get.recipe must be(None)
|
|
||||||
deployment.get.routing.getClass must be(expected.getClass)
|
deployment.get.routing.getClass must be(expected.getClass)
|
||||||
deployment.get.routing.resizer must be(expected.resizer)
|
deployment.get.routing.resizer must be(expected.resizer)
|
||||||
deployment.get.scope must be(LocalScope)
|
deployment.get.scope must be(LocalScope)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec with DefaultTimeout with Impli
|
||||||
"RouterConfig" must {
|
"RouterConfig" must {
|
||||||
|
|
||||||
"be overridable in config" in {
|
"be overridable in config" in {
|
||||||
deployer.deploy(Deploy("/config", null, None, RandomRouter(4), LocalScope))
|
deployer.deploy(Deploy("/config", null, RandomRouter(4), LocalScope))
|
||||||
val actor = system.actorOf(Props(new Actor {
|
val actor = system.actorOf(Props(new Actor {
|
||||||
def receive = {
|
def receive = {
|
||||||
case "get" ⇒ sender ! context.props
|
case "get" ⇒ sender ! context.props
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,7 @@ akka {
|
||||||
# that the values specified in the code shall be used.
|
# that the values specified in the code shall be used.
|
||||||
# In case of routing, the actors to be routed to can be specified
|
# In case of routing, the actors to be routed to can be specified
|
||||||
# in several ways:
|
# in several ways:
|
||||||
# - nr-of-instances: will create that many children given the actor factory
|
# - nr-of-instances: will create that many children
|
||||||
# supplied in the source code (overridable using create-as below)
|
|
||||||
# - routees.paths: will look the paths up using actorFor and route to
|
# - routees.paths: will look the paths up using actorFor and route to
|
||||||
# them, i.e. will not create children
|
# them, i.e. will not create children
|
||||||
# - resizer: dynamically resizable number of routees as specified in resizer below
|
# - resizer: dynamically resizable number of routees as specified in resizer below
|
||||||
|
|
@ -88,11 +87,6 @@ akka {
|
||||||
# within is the timeout used for routers containing future calls
|
# within is the timeout used for routers containing future calls
|
||||||
within = 5 seconds
|
within = 5 seconds
|
||||||
|
|
||||||
create-as {
|
|
||||||
# fully qualified class name of recipe implementation
|
|
||||||
class = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
routees {
|
routees {
|
||||||
# Alternatively to giving nr-of-instances you can specify the full
|
# Alternatively to giving nr-of-instances you can specify the full
|
||||||
# paths of those actors which should be routed to. This setting takes
|
# paths of those actors which should be routed to. This setting takes
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import akka.routing._
|
||||||
import java.util.concurrent.{ TimeUnit, ConcurrentHashMap }
|
import java.util.concurrent.{ TimeUnit, ConcurrentHashMap }
|
||||||
import akka.util.ReflectiveAccess
|
import akka.util.ReflectiveAccess
|
||||||
|
|
||||||
case class Deploy(path: String, config: Config, recipe: Option[ActorRecipe] = None, routing: RouterConfig = NoRouter, scope: Scope = LocalScope)
|
case class Deploy(path: String, config: Config, routing: RouterConfig = NoRouter, scope: Scope = LocalScope)
|
||||||
|
|
||||||
case class ActorRecipe(implementationClass: Class[_ <: Actor]) //TODO Add ActorConfiguration here
|
case class ActorRecipe(implementationClass: Class[_ <: Actor]) //TODO Add ActorConfiguration here
|
||||||
|
|
||||||
|
|
@ -82,16 +82,7 @@ class Deployer(val settings: ActorSystem.Settings) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val recipe: Option[ActorRecipe] =
|
Some(Deploy(key, deployment, router, LocalScope))
|
||||||
deployment.getString("create-as.class") match {
|
|
||||||
case "" ⇒ None
|
|
||||||
case impl ⇒
|
|
||||||
val implementationClass = getClassFor[Actor](impl).fold(e ⇒ throw new ConfigurationException(
|
|
||||||
"Config option [akka.actor.deployment." + key + ".create-as.class] load failed", e), identity)
|
|
||||||
Some(ActorRecipe(implementationClass))
|
|
||||||
}
|
|
||||||
|
|
||||||
Some(Deploy(key, deployment, recipe, router, LocalScope))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,8 +126,8 @@ trait RouterConfig {
|
||||||
|
|
||||||
def adaptFromDeploy(deploy: Option[Deploy]): RouterConfig = {
|
def adaptFromDeploy(deploy: Option[Deploy]): RouterConfig = {
|
||||||
deploy match {
|
deploy match {
|
||||||
case Some(Deploy(_, _, _, NoRouter, _)) ⇒ this
|
case Some(Deploy(_, _, NoRouter, _)) ⇒ this
|
||||||
case Some(Deploy(_, _, _, r, _)) ⇒ r
|
case Some(Deploy(_, _, r, _)) ⇒ r
|
||||||
case _ ⇒ this
|
case _ ⇒ this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ class RemoteActorRefProvider(
|
||||||
})
|
})
|
||||||
|
|
||||||
deployment match {
|
deployment match {
|
||||||
case Some(Deploy(_, _, _, _, RemoteScope(address))) ⇒
|
case Some(Deploy(_, _, _, RemoteScope(address))) ⇒
|
||||||
// FIXME RK this should be done within the deployer, i.e. the whole parsing business
|
// FIXME RK this should be done within the deployer, i.e. the whole parsing business
|
||||||
address.parse(remote.transports) match {
|
address.parse(remote.transports) match {
|
||||||
case Left(x) ⇒
|
case Left(x) ⇒
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ trait RemoteRouterConfig extends RouterConfig {
|
||||||
val impl = context.system.asInstanceOf[ActorSystemImpl] //TODO ticket #1559
|
val impl = context.system.asInstanceOf[ActorSystemImpl] //TODO ticket #1559
|
||||||
IndexedSeq.empty[ActorRef] ++ (for (i ← 1 to nrOfInstances) yield {
|
IndexedSeq.empty[ActorRef] ++ (for (i ← 1 to nrOfInstances) yield {
|
||||||
val name = "c" + i
|
val name = "c" + i
|
||||||
val deploy = Deploy("", ConfigFactory.empty(), None, props.routerConfig, RemoteScope(node.next))
|
val deploy = Deploy("", ConfigFactory.empty(), props.routerConfig, RemoteScope(node.next))
|
||||||
impl.provider.actorOf(impl, props, context.self.asInstanceOf[InternalActorRef], context.self.path / name, false, Some(deploy))
|
impl.provider.actorOf(impl, props, context.self.asInstanceOf[InternalActorRef], context.self.path / name, false, Some(deploy))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ class RemoteDeployerSpec extends AkkaSpec(RemoteDeployerSpec.deployerConf) {
|
||||||
Deploy(
|
Deploy(
|
||||||
service,
|
service,
|
||||||
deployment.get.config,
|
deployment.get.config,
|
||||||
None,
|
|
||||||
RoundRobinRouter(3),
|
RoundRobinRouter(3),
|
||||||
RemoteScope(UnparsedSystemAddress(Some("sys"), UnparsedTransportAddress("akka", "wallace", 2552))))))
|
RemoteScope(UnparsedSystemAddress(Some("sys"), UnparsedTransportAddress("akka", "wallace", 2552))))))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue