Run alarm providers natively in the Rust worker

This commit is contained in:
Joseph Doherty
2026-11-21 09:53:37 -05:00
parent dbc5ea0c25
commit 9293c4c913
13 changed files with 1638 additions and 430 deletions
+23 -22
View File
@@ -38,26 +38,20 @@ by MXAccess. The event also flows through StreamEvents. Bulk results report
per-item COM acceptance and clients can observe commit outcomes on the event
stream.
## Managed alarm provider
## Native alarm provider
The Rust process owns the gateway session, native data operations, and event
sequencing. Alarm commands run in the existing x86 .NET Framework worker, which
owns the WnWrap alarm manager, subtag fallback, watch-list replacement, alarm
snapshots, and acknowledgement. The managed process starts on the first alarm
command. It connects to a private local pipe whose client PID and launch nonce
are checked. A Windows job ties the managed process to the Rust worker's
lifetime.
Build the C# worker with the matching repository revision and deliver its
entire output directory under `alarm-worker` beside the Rust executable. Keep
the managed executable named `ZB.MOM.WW.MxGateway.Worker.exe`, or set
`MXGATEWAY_RUST_ALARM_WORKER_EXE` to its absolute path in the gateway process
environment.
```powershell
dotnet build src/ZB.MOM.WW.MxGateway.Worker -c Release -p:Platform=x86
```
The Rust worker handles alarm subscription, active snapshots, standby watch-list
replacement, and authenticated acknowledgement in the worker process. It uses
the installed 32-bit AVEVA WnWrap COM alarm consumer for Alarmmgr and MXAccess
advice for the optional subtag fallback. The worker polls WnWrap on its COM
thread, emits changes on the existing event queue, and retains previously seen
records that a capped snapshot may have omitted.
To acknowledge a Galaxy alarm, the worker authenticates the operator with
MXAccess, writes the comment to the alarm's `AckMsg` attribute, and waits for
`OnWriteComplete` within the configured write-completion window. Deploy the
Rust executable on a Windows host with the System Platform COM components
registered. The Rust worker has no .NET worker companion.
## Build and test
@@ -109,12 +103,17 @@ $env:MXGATEWAY_LIVE_MXACCESS_ITEM = 'TestChildObject.TestInt'
dotnet test src/ZB.MOM.WW.MxGateway.IntegrationTests --filter FullyQualifiedName~GatewayGrpc_WithRustWorker_WritesAndReceivesOnWriteComplete
```
The remaining parity smoke tests use the deployed `TestChangingInt` items
for bulk snapshots and a read-only, synthetic subtag alarm. Set the absolute
managed worker path before running the alarm test.
The bulk and subtag tests use the deployed `TestChangingInt` items. The
Alarmmgr test raises `Galaxy!TestArea.TestMachine_001.TestAlarm001`, checks that
the gateway rejects an unknown operator, and verifies the authenticated
acknowledgement and its operator attribution on `StreamAlarms`. It restores the
test UDA afterward. The development rig uses `Administrator` with an empty
password. The test accepts credentials through
`MXGATEWAY_LIVE_MXACCESS_WRITE_SECURED_USER` and
`MXGATEWAY_LIVE_MXACCESS_WRITE_SECURED_PASSWORD`.
```powershell
dotnet test src/ZB.MOM.WW.MxGateway.IntegrationTests --filter 'FullyQualifiedName~GatewayGrpc_WithRustWorker_BulkItemsAndReads|FullyQualifiedName~GatewayGrpc_WithRustWorker_ForwardsAlarmProviderCommandsAndEvents'
dotnet test src/ZB.MOM.WW.MxGateway.IntegrationTests --filter 'FullyQualifiedName~GatewayGrpc_WithRustWorker_'
```
## COM interface evidence
@@ -137,3 +136,5 @@ the corresponding native calls and event callbacks.
`ev_1b4fe7ab436437391b76f9fa3a300f45b58a4e1cff6aa84e30854f653c0a20df`
- REA extended COM and buffered event member evidence
`ev_39de39d626e3a933b259fa2650b42311ba60d6844d7b012284467284e8b82977`
- REA member evidence for the WnWrap v1 lifecycle and v2 XML snapshot interfaces
`ev_4fd97bf483b1cde2544b93a90f4de97569ea95c24f1eaa8aee49b5a1ed552558`