feat: replace site registration with database-driven site addressing
Central now resolves site Akka remoting addresses from the Sites DB table (NodeAAddress/NodeBAddress) instead of relying on runtime RegisterSite messages. Eliminates the race condition where sites starting before central had their registration dead-lettered. Addresses are cached in CentralCommunicationActor with 60s periodic refresh and on-demand refresh when sites are added/edited/deleted via UI or CLI.
This commit is contained in:
@@ -169,7 +169,7 @@ akka {{
|
||||
private void RegisterCentralActors()
|
||||
{
|
||||
var centralCommActor = _actorSystem!.ActorOf(
|
||||
Props.Create(() => new CentralCommunicationActor()),
|
||||
Props.Create(() => new CentralCommunicationActor(_serviceProvider)),
|
||||
"central-communication");
|
||||
|
||||
// Wire up the CommunicationService with the actor reference
|
||||
@@ -264,13 +264,8 @@ akka {{
|
||||
var siteCommActor = _actorSystem.ActorSelection("/user/site-communication");
|
||||
siteCommActor.Tell(new RegisterCentralPath(_communicationOptions.CentralActorPath));
|
||||
|
||||
// Also register this site with Central so it knows our address
|
||||
var centralSelection = _actorSystem.ActorSelection(_communicationOptions.CentralActorPath);
|
||||
var localSiteCommPath = $"akka.tcp://scadalink@{_nodeOptions.NodeHostname}:{_nodeOptions.RemotingPort}/user/site-communication";
|
||||
centralSelection.Tell(new RegisterSite(_nodeOptions.SiteId!, localSiteCommPath));
|
||||
|
||||
_logger.LogInformation(
|
||||
"Registered with Central at {CentralPath} as site {SiteId}",
|
||||
"Configured central heartbeat path at {CentralPath} for site {SiteId}",
|
||||
_communicationOptions.CentralActorPath, _nodeOptions.SiteId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user