Docs for multi-DC features

This commit is contained in:
Patrik Nordwall 2017-06-29 16:58:19 +02:00
parent c0d439eac3
commit 87d74f1510
14 changed files with 284 additions and 21 deletions

View file

@ -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 = {

View file

@ -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
}
}