#19192 Cluster extension helper to get full path of an actor ref
This commit is contained in:
parent
f77fd82b10
commit
9d71142748
2 changed files with 21 additions and 0 deletions
|
|
@ -356,6 +356,20 @@ class Cluster(val system: ExtendedActorSystem) extends Extension {
|
|||
else
|
||||
clusterDaemons ! InternalClusterAction.AddOnMemberRemovedListener(callback)
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the remote actor path by replacing the Address in the RootActor Path for the given
|
||||
* ActorRef with the cluster's `selfAddress`, unless address' host is already defined
|
||||
*/
|
||||
def remotePathOf(actorRef: ActorRef): ActorPath = {
|
||||
val path = actorRef.path
|
||||
if (path.address.host.isDefined) {
|
||||
path
|
||||
} else {
|
||||
path.root.copy(selfAddress) / path.elements withUid path.uid
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================================
|
||||
// ===================== INTERNAL API =====================
|
||||
// ========================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue