Fix lookup of coordinator for sharding proxies (#23995)
This commit is contained in:
parent
9e506b25b7
commit
1eb3abb27e
3 changed files with 12 additions and 12 deletions
|
|
@ -479,15 +479,17 @@ class ClusterSharding(system: ExtendedActorSystem) extends Extension {
|
|||
* The entity type must be registered with the [[#start]] or [[#startProxy]] method before it
|
||||
* can be used here. Messages to the entity is always sent via the `ShardRegion`.
|
||||
*/
|
||||
def shardRegion(typeName: String): ActorRef = regions.get(typeName) match {
|
||||
case null ⇒
|
||||
regions.get(typeName) match {
|
||||
case null ⇒
|
||||
throw new IllegalArgumentException(
|
||||
s"Shard type [$typeName] must be started first")
|
||||
case ref ⇒ ref
|
||||
}
|
||||
case ref ⇒ ref
|
||||
def shardRegion(typeName: String): ActorRef = {
|
||||
regions.get(typeName) match {
|
||||
case null ⇒
|
||||
proxies.get(proxyName(typeName, None)) match {
|
||||
case null ⇒
|
||||
throw new IllegalArgumentException(
|
||||
s"Shard type [$typeName] must be started first")
|
||||
case ref ⇒ ref
|
||||
}
|
||||
case ref ⇒ ref
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -650,7 +652,7 @@ private[akka] class ClusterShardingGuardian extends Actor {
|
|||
try {
|
||||
val encName = URLEncoder.encode(s"${typeName}Proxy", ByteString.UTF_8)
|
||||
val cName = coordinatorSingletonManagerName(encName)
|
||||
val cPath = coordinatorPath(encName)
|
||||
val cPath = coordinatorPath(URLEncoder.encode(typeName, ByteString.UTF_8))
|
||||
// it must be possible to start several proxies, one per data center
|
||||
val actorName = dataCenter match {
|
||||
case None ⇒ encName
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import akka.cluster.ClusterSettings.DataCenter
|
|||
* @see [[ClusterSharding$ ClusterSharding extension]]
|
||||
*/
|
||||
object ShardRegion {
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
* Factory method for the [[akka.actor.Props]] of the [[ShardRegion]] actor.
|
||||
|
|
|
|||
|
|
@ -195,7 +195,6 @@ abstract class MultiDcClusterShardingSpec extends MultiNodeSpec(MultiDcClusterSh
|
|||
dataCenter = None, // by default use own DC
|
||||
extractEntityId = extractEntityId,
|
||||
extractShardId = extractShardId)
|
||||
|
||||
proxy ! GetCount("5")
|
||||
expectMsg(1)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue