Phase 2 PR 8 — gateway-level host-status push from MxAccessGalaxyBackend #7
Reference in New Issue
Block a user
Delete Branch "phase-2-pr8-alarms-hoststatus"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Wire gateway-level host-status push from
MxAccessGalaxyBackend. PR 4 built the IPC infrastructure forOnHostStatusChanged(MessageKind.RuntimeStatusChange + ConnectionSink) but no backend raised the event. This PR closes the top-level signal:MxAccessClient.ConnectionStateChanged(already fires on Register / Unregister / reconnect) now drivesOnHostStatusChangedwithHostName=ClientName,RuntimeStatus="Running"/"Stopped",LastObservedUtcUnixMs=now.GalaxyProxyDriver.OnHostConnectivityUpdatealready parses the string status intoHostStateenum and firesHostStatusChangedEventArgsdownstream — so this single backend-side wire-up produces an end-to-end signal with no further Proxy changes.What's in scope
MxAccessClient.ClientNameproperty — exposes the previously-private_clientNameso the backend can tag its pushes with a stable gateway identity.MxAccessGalaxyBackendconstructor subscribes_onConnectionStateChangedbefore returning;Disposeunsubscribes to prevent dangling handler on the MxAccessClient.#pragma warning disable CS0067narrowed to cover onlyOnAlarmEvent(alarm wire-up is PR 9).OnHostStatusChangedis now raised.What's deferred
ScanStateprobes. v1'sGalaxyRuntimeProbeManageris 472 LOC of state-machine (Unknown → Running → Stopped with on-change-only delivery quirk) and deserves its own PR. The gateway signal this PR adds covers the most operationally-important rung — when the Galaxy COM proxy itself dies — which is what wakes operators up at 3am.Tests
ConnectionStateChanged_raises_OnHostStatusChanged_with_gateway_name— fires Connect → Disconnect, asserts 2 notifications withHostName="GatewayClient", status"Running"then"Stopped", timestamp > 0.Dispose_unsubscribes_so_post_dispose_state_changes_do_not_fire_events— asserts the backend detaches its handler on Dispose, so a subsequent disconnect does not bump a registered event subscriber.Test plan
dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Host/— 0 errors, 0 warningsdotnet test .../Host.Tests/ --filter "Category=Unit"— 26/26 pass (2 new + 24 pre-existing)Running→Stoppedwithin the MonitorInterval window.Merge order
Branches off
phase-2-pr5-historianbecause PR 5 already added theIHistorianDataSource? historianconstructor parameter and the Dispose implementation now coordinates two unsubscribes. Thelib/ArchestrA.MxAccess.dlltest reference duplicates the one PR 6 adds — git will collapse to one when either PR lands first.🤖 Generated with Claude Code