format source with scalafmt, #26511
This commit is contained in:
parent
2ba9b988df
commit
75579bed17
779 changed files with 15729 additions and 13096 deletions
|
|
@ -72,8 +72,9 @@ object ClusterShardingCustomShardAllocationSpec {
|
|||
(ref ? AllocateReq).mapTo[ActorRef]
|
||||
}
|
||||
|
||||
override def rebalance(currentShardAllocations: Map[ActorRef, immutable.IndexedSeq[ShardRegion.ShardId]],
|
||||
rebalanceInProgress: Set[ShardRegion.ShardId]): Future[Set[ShardRegion.ShardId]] = {
|
||||
override def rebalance(
|
||||
currentShardAllocations: Map[ActorRef, immutable.IndexedSeq[ShardRegion.ShardId]],
|
||||
rebalanceInProgress: Set[ShardRegion.ShardId]): Future[Set[ShardRegion.ShardId]] = {
|
||||
(ref ? RebalanceReq).mapTo[Set[String]]
|
||||
}
|
||||
}
|
||||
|
|
@ -139,13 +140,14 @@ abstract class ClusterShardingCustomShardAllocationSpec(config: ClusterShardingC
|
|||
}
|
||||
|
||||
def startSharding(): Unit = {
|
||||
ClusterSharding(system).start(typeName = "Entity",
|
||||
entityProps = Props[Entity],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId,
|
||||
allocationStrategy = TestAllocationStrategy(allocator),
|
||||
handOffStopMessage = PoisonPill)
|
||||
ClusterSharding(system).start(
|
||||
typeName = "Entity",
|
||||
entityProps = Props[Entity],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId,
|
||||
allocationStrategy = TestAllocationStrategy(allocator),
|
||||
handOffStopMessage = PoisonPill)
|
||||
}
|
||||
|
||||
lazy val region = ClusterSharding(system).shardRegion("Entity")
|
||||
|
|
|
|||
|
|
@ -139,11 +139,12 @@ abstract class ClusterShardingFailureSpec(config: ClusterShardingFailureSpecConf
|
|||
}
|
||||
|
||||
def startSharding(): Unit = {
|
||||
ClusterSharding(system).start(typeName = "Entity",
|
||||
entityProps = Props[Entity],
|
||||
settings = ClusterShardingSettings(system).withRememberEntities(true),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
ClusterSharding(system).start(
|
||||
typeName = "Entity",
|
||||
entityProps = Props[Entity],
|
||||
settings = ClusterShardingSettings(system).withRememberEntities(true),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
}
|
||||
|
||||
lazy val region = ClusterSharding(system).shardRegion("Entity")
|
||||
|
|
|
|||
|
|
@ -79,18 +79,20 @@ abstract class ClusterShardingGetStateSpec
|
|||
def initialParticipants = roles.size
|
||||
|
||||
def startShard(): ActorRef = {
|
||||
ClusterSharding(system).start(typeName = shardTypeName,
|
||||
entityProps = Props(new ShardedActor),
|
||||
settings = ClusterShardingSettings(system).withRole("shard"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
ClusterSharding(system).start(
|
||||
typeName = shardTypeName,
|
||||
entityProps = Props(new ShardedActor),
|
||||
settings = ClusterShardingSettings(system).withRole("shard"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
}
|
||||
|
||||
def startProxy(): ActorRef = {
|
||||
ClusterSharding(system).startProxy(typeName = shardTypeName,
|
||||
role = Some("shard"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
ClusterSharding(system).startProxy(
|
||||
typeName = shardTypeName,
|
||||
role = Some("shard"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
}
|
||||
|
||||
def join(from: RoleName): Unit = {
|
||||
|
|
|
|||
|
|
@ -82,18 +82,20 @@ abstract class ClusterShardingGetStatsSpec
|
|||
def initialParticipants = roles.size
|
||||
|
||||
def startShard(): ActorRef = {
|
||||
ClusterSharding(system).start(typeName = shardTypeName,
|
||||
entityProps = Props(new ShardedActor),
|
||||
settings = ClusterShardingSettings(system).withRole("shard"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
ClusterSharding(system).start(
|
||||
typeName = shardTypeName,
|
||||
entityProps = Props(new ShardedActor),
|
||||
settings = ClusterShardingSettings(system).withRole("shard"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
}
|
||||
|
||||
def startProxy(): ActorRef = {
|
||||
ClusterSharding(system).startProxy(typeName = shardTypeName,
|
||||
role = Some("shard"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
ClusterSharding(system).startProxy(
|
||||
typeName = shardTypeName,
|
||||
role = Some("shard"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
}
|
||||
|
||||
def join(from: RoleName): Unit = {
|
||||
|
|
|
|||
|
|
@ -115,13 +115,14 @@ abstract class ClusterShardingGracefulShutdownSpec(config: ClusterShardingGracef
|
|||
def startSharding(): Unit = {
|
||||
val allocationStrategy =
|
||||
new ShardCoordinator.LeastShardAllocationStrategy(rebalanceThreshold = 2, maxSimultaneousRebalance = 1)
|
||||
ClusterSharding(system).start(typeName = "Entity",
|
||||
entityProps = Props[Entity],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId,
|
||||
allocationStrategy,
|
||||
handOffStopMessage = StopEntity)
|
||||
ClusterSharding(system).start(
|
||||
typeName = "Entity",
|
||||
entityProps = Props[Entity],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId,
|
||||
allocationStrategy,
|
||||
handOffStopMessage = StopEntity)
|
||||
}
|
||||
|
||||
lazy val region = ClusterSharding(system).shardRegion("Entity")
|
||||
|
|
@ -194,13 +195,14 @@ abstract class ClusterShardingGracefulShutdownSpec(config: ClusterShardingGracef
|
|||
runOn(first) {
|
||||
val allocationStrategy =
|
||||
new ShardCoordinator.LeastShardAllocationStrategy(rebalanceThreshold = 2, maxSimultaneousRebalance = 1)
|
||||
val regionEmpty = ClusterSharding(system).start(typeName = "EntityEmpty",
|
||||
entityProps = Props[Entity],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId,
|
||||
allocationStrategy,
|
||||
handOffStopMessage = StopEntity)
|
||||
val regionEmpty = ClusterSharding(system).start(
|
||||
typeName = "EntityEmpty",
|
||||
entityProps = Props[Entity],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId,
|
||||
allocationStrategy,
|
||||
handOffStopMessage = StopEntity)
|
||||
|
||||
watch(regionEmpty)
|
||||
regionEmpty ! GracefulShutdown
|
||||
|
|
|
|||
|
|
@ -50,11 +50,12 @@ abstract class ClusterShardingIncorrectSetupSpec
|
|||
enterBarrier("cluster-up")
|
||||
runOn(first) {
|
||||
EventFilter.error(pattern = """Has ClusterSharding been started on all nodes?""").intercept {
|
||||
ClusterSharding(system).start(typeName = "Entity",
|
||||
entityProps = TestActors.echoActorProps,
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
ClusterSharding(system).start(
|
||||
typeName = "Entity",
|
||||
entityProps = TestActors.echoActorProps,
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
}
|
||||
}
|
||||
enterBarrier("helpful error message logged")
|
||||
|
|
|
|||
|
|
@ -136,11 +136,12 @@ abstract class ClusterShardingLeavingSpec(config: ClusterShardingLeavingSpecConf
|
|||
}
|
||||
|
||||
def startSharding(): Unit = {
|
||||
ClusterSharding(system).start(typeName = "Entity",
|
||||
entityProps = Props[Entity],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
ClusterSharding(system).start(
|
||||
typeName = "Entity",
|
||||
entityProps = Props[Entity],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
}
|
||||
|
||||
lazy val region = ClusterSharding(system).shardRegion("Entity")
|
||||
|
|
|
|||
|
|
@ -112,13 +112,14 @@ abstract class ClusterShardingMinMembersSpec(config: ClusterShardingMinMembersSp
|
|||
def startSharding(): Unit = {
|
||||
val allocationStrategy =
|
||||
new ShardCoordinator.LeastShardAllocationStrategy(rebalanceThreshold = 2, maxSimultaneousRebalance = 1)
|
||||
ClusterSharding(system).start(typeName = "Entity",
|
||||
entityProps = TestActors.echoActorProps,
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId,
|
||||
allocationStrategy,
|
||||
handOffStopMessage = StopEntity)
|
||||
ClusterSharding(system).start(
|
||||
typeName = "Entity",
|
||||
entityProps = TestActors.echoActorProps,
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId,
|
||||
allocationStrategy,
|
||||
handOffStopMessage = StopEntity)
|
||||
}
|
||||
|
||||
lazy val region = ClusterSharding(system).shardRegion("Entity")
|
||||
|
|
|
|||
|
|
@ -160,21 +160,21 @@ abstract class ClusterShardingRememberEntitiesNewExtractorSpec(
|
|||
val cluster = Cluster(system)
|
||||
|
||||
def startShardingWithExtractor1(): Unit = {
|
||||
ClusterSharding(system).start(typeName = typeName,
|
||||
entityProps = ClusterShardingRememberEntitiesNewExtractorSpec.props(None),
|
||||
settings =
|
||||
ClusterShardingSettings(system).withRememberEntities(true).withRole("sharding"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId1)
|
||||
ClusterSharding(system).start(
|
||||
typeName = typeName,
|
||||
entityProps = ClusterShardingRememberEntitiesNewExtractorSpec.props(None),
|
||||
settings = ClusterShardingSettings(system).withRememberEntities(true).withRole("sharding"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId1)
|
||||
}
|
||||
|
||||
def startShardingWithExtractor2(sys: ActorSystem, probe: ActorRef): Unit = {
|
||||
ClusterSharding(sys).start(typeName = typeName,
|
||||
entityProps = ClusterShardingRememberEntitiesNewExtractorSpec.props(Some(probe)),
|
||||
settings =
|
||||
ClusterShardingSettings(system).withRememberEntities(true).withRole("sharding"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId2)
|
||||
ClusterSharding(sys).start(
|
||||
typeName = typeName,
|
||||
entityProps = ClusterShardingRememberEntitiesNewExtractorSpec.props(Some(probe)),
|
||||
settings = ClusterShardingSettings(system).withRememberEntities(true).withRole("sharding"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId2)
|
||||
}
|
||||
|
||||
def region(sys: ActorSystem = system) = ClusterSharding(sys).shardRegion(typeName)
|
||||
|
|
|
|||
|
|
@ -130,11 +130,12 @@ abstract class ClusterShardingRememberEntitiesSpec(config: ClusterShardingRememb
|
|||
val cluster = Cluster(system)
|
||||
|
||||
def startSharding(sys: ActorSystem = system, probe: ActorRef = testActor): Unit = {
|
||||
ClusterSharding(sys).start(typeName = "Entity",
|
||||
entityProps = ClusterShardingRememberEntitiesSpec.props(probe),
|
||||
settings = ClusterShardingSettings(system).withRememberEntities(true),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
ClusterSharding(sys).start(
|
||||
typeName = "Entity",
|
||||
entityProps = ClusterShardingRememberEntitiesSpec.props(probe),
|
||||
settings = ClusterShardingSettings(system).withRememberEntities(true),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
}
|
||||
|
||||
lazy val region = ClusterSharding(system).shardRegion("Entity")
|
||||
|
|
|
|||
|
|
@ -78,11 +78,12 @@ abstract class ClusterShardingSingleShardPerEntitySpec
|
|||
}
|
||||
|
||||
def startSharding(): Unit = {
|
||||
ClusterSharding(system).start(typeName = "Entity",
|
||||
entityProps = Props[Entity],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
ClusterSharding(system).start(
|
||||
typeName = "Entity",
|
||||
entityProps = Props[Entity],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
}
|
||||
|
||||
lazy val region = ClusterSharding(system).shardRegion("Entity")
|
||||
|
|
|
|||
|
|
@ -300,27 +300,28 @@ abstract class ClusterShardingSpec(config: ClusterShardingSpecConfig)
|
|||
ShardCoordinator.props(typeName, settings, allocationStrategy, replicator, majorityMinCap)
|
||||
}
|
||||
|
||||
List("counter",
|
||||
"rebalancingCounter",
|
||||
"RememberCounterEntities",
|
||||
"AnotherRememberCounter",
|
||||
"RememberCounter",
|
||||
"RebalancingRememberCounter",
|
||||
"AutoMigrateRememberRegionTest").foreach { typeName =>
|
||||
List(
|
||||
"counter",
|
||||
"rebalancingCounter",
|
||||
"RememberCounterEntities",
|
||||
"AnotherRememberCounter",
|
||||
"RememberCounter",
|
||||
"RebalancingRememberCounter",
|
||||
"AutoMigrateRememberRegionTest").foreach { typeName =>
|
||||
val rebalanceEnabled = typeName.toLowerCase.startsWith("rebalancing")
|
||||
val rememberEnabled = typeName.toLowerCase.contains("remember")
|
||||
val singletonProps = BackoffSupervisor
|
||||
.props(childProps = coordinatorProps(typeName, rebalanceEnabled, rememberEnabled),
|
||||
childName = "coordinator",
|
||||
minBackoff = 5.seconds,
|
||||
maxBackoff = 5.seconds,
|
||||
randomFactor = 0.1,
|
||||
maxNrOfRetries = -1)
|
||||
.props(
|
||||
childProps = coordinatorProps(typeName, rebalanceEnabled, rememberEnabled),
|
||||
childName = "coordinator",
|
||||
minBackoff = 5.seconds,
|
||||
maxBackoff = 5.seconds,
|
||||
randomFactor = 0.1,
|
||||
maxNrOfRetries = -1)
|
||||
.withDeploy(Deploy.local)
|
||||
system.actorOf(
|
||||
ClusterSingletonManager.props(singletonProps,
|
||||
terminationMessage = PoisonPill,
|
||||
settings = ClusterSingletonManagerSettings(system)),
|
||||
ClusterSingletonManager
|
||||
.props(singletonProps, terminationMessage = PoisonPill, settings = ClusterSingletonManagerSettings(system)),
|
||||
name = typeName + "Coordinator")
|
||||
}
|
||||
}
|
||||
|
|
@ -334,15 +335,16 @@ abstract class ClusterShardingSpec(config: ClusterShardingSpecConfig)
|
|||
""").withFallback(system.settings.config.getConfig("akka.cluster.sharding"))
|
||||
val settings = ClusterShardingSettings(cfg).withRememberEntities(rememberEntities)
|
||||
system.actorOf(
|
||||
ShardRegion.props(typeName = typeName,
|
||||
entityProps = _ => qualifiedCounterProps(typeName),
|
||||
settings = settings,
|
||||
coordinatorPath = "/user/" + typeName + "Coordinator/singleton/coordinator",
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId,
|
||||
handOffStopMessage = PoisonPill,
|
||||
replicator,
|
||||
majorityMinCap = 3),
|
||||
ShardRegion.props(
|
||||
typeName = typeName,
|
||||
entityProps = _ => qualifiedCounterProps(typeName),
|
||||
settings = settings,
|
||||
coordinatorPath = "/user/" + typeName + "Coordinator/singleton/coordinator",
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId,
|
||||
handOffStopMessage = PoisonPill,
|
||||
replicator,
|
||||
majorityMinCap = 3),
|
||||
name = typeName + "Region")
|
||||
}
|
||||
|
||||
|
|
@ -463,16 +465,17 @@ abstract class ClusterShardingSpec(config: ClusterShardingSpecConfig)
|
|||
buffer-size = 1000
|
||||
""").withFallback(system.settings.config.getConfig("akka.cluster.sharding"))
|
||||
val settings = ClusterShardingSettings(cfg)
|
||||
val proxy = system.actorOf(ShardRegion.proxyProps(typeName = "counter",
|
||||
dataCenter = None,
|
||||
settings,
|
||||
coordinatorPath =
|
||||
"/user/counterCoordinator/singleton/coordinator",
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId,
|
||||
system.deadLetters,
|
||||
majorityMinCap = 0),
|
||||
name = "regionProxy")
|
||||
val proxy = system.actorOf(
|
||||
ShardRegion.proxyProps(
|
||||
typeName = "counter",
|
||||
dataCenter = None,
|
||||
settings,
|
||||
coordinatorPath = "/user/counterCoordinator/singleton/coordinator",
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId,
|
||||
system.deadLetters,
|
||||
majorityMinCap = 0),
|
||||
name = "regionProxy")
|
||||
|
||||
proxy ! Get(1)
|
||||
expectMsg(2)
|
||||
|
|
@ -632,24 +635,27 @@ abstract class ClusterShardingSpec(config: ClusterShardingSpecConfig)
|
|||
"easy to use with extensions" in within(50.seconds) {
|
||||
runOn(third, fourth, fifth, sixth) {
|
||||
//#counter-start
|
||||
val counterRegion: ActorRef = ClusterSharding(system).start(typeName = "Counter",
|
||||
entityProps = Props[Counter],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
val counterRegion: ActorRef = ClusterSharding(system).start(
|
||||
typeName = "Counter",
|
||||
entityProps = Props[Counter],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
//#counter-start
|
||||
ClusterSharding(system).start(typeName = "AnotherCounter",
|
||||
entityProps = Props[AnotherCounter],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
ClusterSharding(system).start(
|
||||
typeName = "AnotherCounter",
|
||||
entityProps = Props[AnotherCounter],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
|
||||
//#counter-supervisor-start
|
||||
ClusterSharding(system).start(typeName = "SupervisedCounter",
|
||||
entityProps = Props[CounterSupervisor],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
ClusterSharding(system).start(
|
||||
typeName = "SupervisedCounter",
|
||||
entityProps = Props[CounterSupervisor],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
//#counter-supervisor-start
|
||||
}
|
||||
enterBarrier("extension-started")
|
||||
|
|
@ -686,11 +692,12 @@ abstract class ClusterShardingSpec(config: ClusterShardingSpecConfig)
|
|||
}
|
||||
"easy API for starting" in within(50.seconds) {
|
||||
runOn(first) {
|
||||
val counterRegionViaStart: ActorRef = ClusterSharding(system).start(typeName = "ApiTest",
|
||||
entityProps = Props[Counter],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
val counterRegionViaStart: ActorRef = ClusterSharding(system).start(
|
||||
typeName = "ApiTest",
|
||||
entityProps = Props[Counter],
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
|
||||
val counterRegionViaGet: ActorRef = ClusterSharding(system).shardRegion("ApiTest")
|
||||
|
||||
|
|
@ -703,11 +710,12 @@ abstract class ClusterShardingSpec(config: ClusterShardingSpecConfig)
|
|||
"demonstrate API for DC proxy" in within(50.seconds) {
|
||||
runOn(sixth) {
|
||||
// #proxy-dc
|
||||
val counterProxyDcB: ActorRef = ClusterSharding(system).startProxy(typeName = "Counter",
|
||||
role = None,
|
||||
dataCenter = Some("B"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
val counterProxyDcB: ActorRef = ClusterSharding(system).startProxy(
|
||||
typeName = "Counter",
|
||||
role = None,
|
||||
dataCenter = Some("B"),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
// #proxy-dc
|
||||
}
|
||||
enterBarrier("after-dc-proxy")
|
||||
|
|
|
|||
|
|
@ -105,11 +105,12 @@ abstract class MultiDcClusterShardingSpec
|
|||
}
|
||||
|
||||
def startSharding(): Unit = {
|
||||
ClusterSharding(system).start(typeName = "Entity",
|
||||
entityProps = Props[Entity](),
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
ClusterSharding(system).start(
|
||||
typeName = "Entity",
|
||||
entityProps = Props[Entity](),
|
||||
settings = ClusterShardingSettings(system),
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
}
|
||||
|
||||
lazy val region = ClusterSharding(system).shardRegion("Entity")
|
||||
|
|
@ -193,11 +194,12 @@ abstract class MultiDcClusterShardingSpec
|
|||
|
||||
"allow proxy within same data center" in {
|
||||
runOn(second) {
|
||||
val proxy = ClusterSharding(system).startProxy(typeName = "Entity",
|
||||
role = None,
|
||||
dataCenter = None, // by default use own DC
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
val proxy = ClusterSharding(system).startProxy(
|
||||
typeName = "Entity",
|
||||
role = None,
|
||||
dataCenter = None, // by default use own DC
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
proxy ! GetCount("5")
|
||||
expectMsg(1)
|
||||
}
|
||||
|
|
@ -206,11 +208,12 @@ abstract class MultiDcClusterShardingSpec
|
|||
|
||||
"allow proxy across different data centers" in {
|
||||
runOn(second) {
|
||||
val proxy = ClusterSharding(system).startProxy(typeName = "Entity",
|
||||
role = None,
|
||||
dataCenter = Some("DC2"), // proxy to other DC
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
val proxy = ClusterSharding(system).startProxy(
|
||||
typeName = "Entity",
|
||||
role = None,
|
||||
dataCenter = Some("DC2"), // proxy to other DC
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
|
||||
proxy ! GetCount("5")
|
||||
expectMsg(2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue