Complete Rust worker command coverage and bridge the alarm provider

This commit is contained in:
Joseph Doherty
2026-11-21 09:34:41 -05:00
parent d1769f81ff
commit dbc5ea0c25
12 changed files with 1945 additions and 160 deletions
+44 -7
View File
@@ -6,9 +6,10 @@ schemas at build time.
The worker authenticates the launch nonce, negotiates a frame limit, activates
LMXProxy on a dedicated message-pumping STA, and reports readiness and heartbeats.
It supports Register, Unregister, AddItem, RemoveItem, Advise,
AdviseSupervisory, UnAdvise, and the worker diagnostic commands. The worker uses the base MXAccess COM connection
point for OnDataChange, OperationComplete, and OnWriteComplete notifications.
It supports registration, item lifecycle and advice, value snapshots, identity
lookup, writes, and the worker diagnostic commands. The worker attaches to
both MXAccess COM connection points to deliver OnDataChange, OperationComplete,
OnWriteComplete, and OnBufferedDataChange notifications.
OnDataChange carries the value, quality, MXAccess status records, source
timestamp when available, and worker sequence and timestamp. The bounded queue
faults the session on overflow. Shutdown detaches the sink, unadvises remaining
@@ -17,10 +18,15 @@ gateway default.
Event conversion supports standard Automation scalar values and homogeneous
arrays of those types. Other variant types are reported as unknown with the
Automation type in the diagnostic. The worker serializes commands and faults
the session if a COM call exceeds the STA timeout. Buffered advice, bulk
subscriptions, snapshot reads, and alarm commands are outside the current
implementation.
Automation type in the diagnostic. The worker serializes COM commands, accepts
cancellation for commands still waiting, and continues sending events and
heartbeats while a command runs. A COM call that exceeds the STA ceiling faults
the session.
Bulk item operations return one ordered result per requested item. ReadBulk
uses a cached value for an existing advice when available and otherwise uses
temporary advice with a shared timeout. Duplicate snapshot reads share one
subscription.
The worker supports Write, Write2, WriteSecured, and WriteSecured2, including
their bulk forms. It converts scalar and typed array inputs to Automation
@@ -32,6 +38,27 @@ 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
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
```
## Build and test
From this directory on Windows, with Rust, the x86 MSVC target and linker, and
@@ -82,6 +109,14 @@ $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.
```powershell
dotnet test src/ZB.MOM.WW.MxGateway.IntegrationTests --filter 'FullyQualifiedName~GatewayGrpc_WithRustWorker_BulkItemsAndReads|FullyQualifiedName~GatewayGrpc_WithRustWorker_ForwardsAlarmProviderCommandsAndEvents'
```
## COM interface evidence
The native adapter uses the dual `ILMXProxyServer` interface from the installed
@@ -100,3 +135,5 @@ the corresponding native calls and event callbacks.
`ev_97162abcd831b2d84b5b43fb72cd9876252bbe3bb0af5c4673a6954911500e54`
- REA write member evidence for `ILMXProxyServer` and `ILMXProxyServer4`
`ev_1b4fe7ab436437391b76f9fa3a300f45b58a4e1cff6aa84e30854f653c0a20df`
- REA extended COM and buffered event member evidence
`ev_39de39d626e3a933b259fa2650b42311ba60d6844d7b012284467284e8b82977`