pekko/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala

38 lines
1 KiB
Scala
Raw Normal View History

/**
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.remote
import akka.actor._
import akka.actor.DeploymentConfig._
import akka.event.EventStream
import com.typesafe.config._
import akka.config.ConfigurationException
object RemoteDeploymentConfig {
case class RemoteScope(node: RemoteAddress) extends DeploymentConfig.Scope
}
class RemoteDeployer(_settings: ActorSystem.Settings) extends Deployer(_settings) {
import RemoteDeploymentConfig._
override protected def parseConfig(path: String, config: Config): Option[Deploy] = {
import scala.collection.JavaConverters._
import akka.util.ReflectiveAccess._
val deployment = config.withFallback(default)
val transform: Deploy Deploy =
if (deployment.hasPath("remote")) deployment.getString("remote") match {
case RemoteAddressExtractor(r) (d d.copy(scope = RemoteScope(r)))
case _ identity
}
else identity
super.parseConfig(path, config) map transform
}
}