|
Akka/Scala example source code file (RemoteDeployer.scala)
The RemoteDeployer.scala Akka example source code
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.remote
import akka.actor._
import akka.routing._
import akka.remote.routing._
import akka.ConfigurationException
import akka.japi.Util.immutableSeq
import com.typesafe.config._
import akka.routing.Pool
import akka.remote.routing.RemoteRouterConfig
@SerialVersionUID(1L)
final case class RemoteScope(node: Address) extends Scope {
def withFallback(other: Scope): Scope = this
}
/**
* INTERNAL API
*/
private[akka] class RemoteDeployer(_settings: ActorSystem.Settings, _pm: DynamicAccess) extends Deployer(_settings, _pm) {
override def parseConfig(path: String, config: Config): Option[Deploy] = {
import scala.collection.JavaConverters._
super.parseConfig(path, config) match {
case d @ Some(deploy) ⇒
deploy.config.getString("remote") match {
case AddressFromURIString(r) ⇒ Some(deploy.copy(scope = RemoteScope(r)))
case str if !str.isEmpty ⇒ throw new ConfigurationException(s"unparseable remote node name [${str}]")
case _ ⇒
val nodes = immutableSeq(deploy.config.getStringList("target.nodes")).map(AddressFromURIString(_))
if (nodes.isEmpty || deploy.routerConfig == NoRouter) d
else deploy.routerConfig match {
case r: Pool ⇒ Some(deploy.copy(routerConfig = RemoteRouterConfig(r, nodes)))
case _ ⇒ d
}
}
case None ⇒ None
}
}
}
Other Akka source code examplesHere is a short list of links related to this Akka RemoteDeployer.scala source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.