Deploy to new members in cluster, see #2103

* Config max-nr-of-instances-per-node
* selectDeploymentTarget that takes max-nr-of-instances-per-node
  and nr-of-instances into account
* Deploy when new member added or removed
* Moved routeeProps to RouteeProvider constructor, needed for
  this feature, but also simplifies createRoute, createRoutee,
  and resize, since routeeProps doesn't have to be passed around.
This commit is contained in:
Patrik Nordwall 2012-08-29 19:33:19 +02:00
parent bf20ae5157
commit 695ce49727
9 changed files with 185 additions and 127 deletions

View file

@ -33,12 +33,17 @@ private[akka] class ClusterDeployer(_settings: ActorSystem.Settings, _pm: Dynami
override def parseConfig(path: String, config: Config): Option[Deploy] = {
super.parseConfig(path, config) match {
case d @ Some(deploy)
if (deploy.config.getBoolean("cluster")) {
if (deploy.config.getBoolean("cluster.enabled")) {
if (deploy.scope != NoScopeGiven)
throw new ConfigurationException("Cluster deployment can't be combined with scope [%s]".format(deploy.scope))
if (deploy.routerConfig.isInstanceOf[RemoteRouterConfig])
throw new ConfigurationException("Cluster deployment can't be combined with [%s]".format(deploy.routerConfig))
Some(deploy.copy(routerConfig = ClusterRouterConfig(deploy.routerConfig)))
val totalInstances = deploy.config.getInt("nr-of-instances")
val maxInstancesPerNode = deploy.config.getInt("cluster.max-nr-of-instances-per-node")
Some(deploy.copy(
routerConfig = ClusterRouterConfig(deploy.routerConfig, totalInstances, maxInstancesPerNode),
scope = ClusterScope))
} else d
case None None
}