fix(comm+site): route BrowseOpcUaNodeCommand via DeploymentManagerActor singleton

This commit is contained in:
Joseph Doherty
2026-05-28 12:51:45 -04:00
parent 2c138b6a25
commit f401a9ea0e
2 changed files with 17 additions and 16 deletions
@@ -146,22 +146,13 @@ public class SiteCommunicationActor : ReceiveActor, IWithTimers
Receive<RouteToSetAttributesRequest>(msg => _deploymentManagerProxy.Forward(msg)); Receive<RouteToSetAttributesRequest>(msg => _deploymentManagerProxy.Forward(msg));
// OPC UA Tag Browser (interactive design-time query) — forward to the // OPC UA Tag Browser (interactive design-time query) — forward to the
// site-local Data Connection Manager actor, which owns the in-memory // Deployment Manager singleton, which always lands on the active site
// map of live data-connection adapters keyed by ConnectionName and // node. Routing to the site-local /user/dcl-manager directly is wrong
// executes the browse against the appropriate OPC UA client. The // because the standby node has a dcl-manager too, but its
// manager is not a child of DeploymentManagerActor, so we route via // DataConnectionActor children (which own the live OPC UA sessions)
// ActorSelection rather than the _deploymentManagerProxy field; the // only exist on the singleton's node. The singleton then re-forwards
// path matches the registration in AkkaHostedService. ActorSelection // to its own /user/dcl-manager, which DOES have the connection.
// has no Forward() helper, so we Tell with the original Sender so the Receive<BrowseOpcUaNodeCommand>(msg => _deploymentManagerProxy.Forward(msg));
// BrowseOpcUaNodeResult routes straight back to the central UI's Ask
// (via the CentralCommunicationActor sender chain), not to us.
Receive<BrowseOpcUaNodeCommand>(msg =>
{
_log.Debug(
"Routing BrowseOpcUaNodeCommand for connection '{0}' to DataConnectionManager",
msg.ConnectionName);
Context.ActorSelection("/user/dcl-manager").Tell(msg, Sender);
});
// Pattern 7: Remote Queries // Pattern 7: Remote Queries
Receive<EventLogQueryRequest>(msg => Receive<EventLogQueryRequest>(msg =>
@@ -6,6 +6,7 @@ using ZB.MOM.WW.ScadaBridge.Commons.Messages.Deployment;
using ZB.MOM.WW.ScadaBridge.Commons.Messages.InboundApi; using ZB.MOM.WW.ScadaBridge.Commons.Messages.InboundApi;
using ZB.MOM.WW.ScadaBridge.Commons.Messages.Instance; using ZB.MOM.WW.ScadaBridge.Commons.Messages.Instance;
using ZB.MOM.WW.ScadaBridge.Commons.Messages.Lifecycle; using ZB.MOM.WW.ScadaBridge.Commons.Messages.Lifecycle;
using ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
using ZB.MOM.WW.ScadaBridge.Commons.Messages.ScriptExecution; using ZB.MOM.WW.ScadaBridge.Commons.Messages.ScriptExecution;
using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums; using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
using ZB.MOM.WW.ScadaBridge.HealthMonitoring; using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
@@ -147,6 +148,15 @@ public class DeploymentManagerActor : ReceiveActor, IWithTimers
Receive<RouteToGetAttributesRequest>(RouteInboundApiGetAttributes); Receive<RouteToGetAttributesRequest>(RouteInboundApiGetAttributes);
Receive<RouteToSetAttributesRequest>(RouteInboundApiSetAttributes); Receive<RouteToSetAttributesRequest>(RouteInboundApiSetAttributes);
// OPC UA Tag Browser — singleton-only re-forward to local /user/dcl-manager.
// BrowseOpcUaNodeCommand is routed to this singleton (active node) by
// SiteCommunicationActor so the dcl-manager we forward to is guaranteed
// to be the one holding the live DataConnectionActor children. ActorSelection
// has no Forward() extension in this Akka.NET version, so we Tell with the
// original Sender preserved (semantically identical to Forward).
Receive<BrowseOpcUaNodeCommand>(msg =>
Context.ActorSelection("/user/dcl-manager").Tell(msg, Sender));
// Internal startup messages // Internal startup messages
Receive<StartupConfigsLoaded>(HandleStartupConfigsLoaded); Receive<StartupConfigsLoaded>(HandleStartupConfigsLoaded);
Receive<SharedScriptsLoaded>(HandleSharedScriptsLoaded); Receive<SharedScriptsLoaded>(HandleSharedScriptsLoaded);