Docs for multi-DC features
This commit is contained in:
parent
c0d439eac3
commit
87d74f1510
14 changed files with 284 additions and 21 deletions
|
|
@ -228,12 +228,26 @@ class ClusterSingletonManagerSpec extends MultiNodeSpec(ClusterSingletonManagerS
|
|||
|
||||
def createSingletonProxy(): ActorRef = {
|
||||
//#create-singleton-proxy
|
||||
system.actorOf(
|
||||
val proxy = system.actorOf(
|
||||
ClusterSingletonProxy.props(
|
||||
singletonManagerPath = "/user/consumer",
|
||||
settings = ClusterSingletonProxySettings(system).withRole("worker")),
|
||||
name = "consumerProxy")
|
||||
//#create-singleton-proxy
|
||||
proxy
|
||||
}
|
||||
|
||||
def createSingletonProxyDc(): ActorRef = {
|
||||
//#create-singleton-proxy-dc
|
||||
val proxyDcB = system.actorOf(
|
||||
ClusterSingletonProxy.props(
|
||||
singletonManagerPath = "/user/consumer",
|
||||
settings = ClusterSingletonProxySettings(system)
|
||||
.withRole("worker")
|
||||
.withDataCenter("B")),
|
||||
name = "consumerProxyDcB")
|
||||
//#create-singleton-proxy-dc
|
||||
proxyDcB
|
||||
}
|
||||
|
||||
def verifyProxyMsg(oldest: RoleName, proxyNode: RoleName, msg: Int): Unit = {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@
|
|||
package akka.cluster.singleton;
|
||||
|
||||
import akka.actor.ActorSystem;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.Props;
|
||||
|
||||
|
|
@ -32,8 +36,17 @@ public class ClusterSingletonManagerTest {
|
|||
ClusterSingletonProxySettings proxySettings =
|
||||
ClusterSingletonProxySettings.create(system).withRole("worker");
|
||||
|
||||
system.actorOf(ClusterSingletonProxy.props("/user/consumer", proxySettings),
|
||||
ActorRef proxy =
|
||||
system.actorOf(ClusterSingletonProxy.props("/user/consumer", proxySettings),
|
||||
"consumerProxy");
|
||||
//#create-singleton-proxy
|
||||
|
||||
//#create-singleton-proxy-dc
|
||||
ActorRef proxyDcB =
|
||||
system.actorOf(ClusterSingletonProxy.props("/user/consumer",
|
||||
ClusterSingletonProxySettings.create(system)
|
||||
.withRole("worker")
|
||||
.withDataCenter("B")), "consumerProxyDcB");
|
||||
//#create-singleton-proxy-dc
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue