sidecar: wire IAlarmEventWriter into Program.cs (PR C.2) #411
Reference in New Issue
Block a user
Delete Branch "track-c2-program-wires-alarm-writer"
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
Fifth PR of the alarms-over-gateway epic (docs/plans/alarms-over-gateway.md). Depends on PR C.1 (#410, merged).
Today HistorianFrameHandler is constructed at
Program.cs:57without analarmWriter, so every WriteAlarmEvents frame replies "Sidecar not configured with an alarm-event writer" and the lmxopcua side keeps the row queued. This PR wires a real writer behind a newOTOPCUA_HISTORIAN_ALARM_WRITE_ENABLEDtoggle.Program.BuildAlarmWriter— env-gated (default true; fail-open under accidental misconfiguration). Constructs anAahClientManagedAlarmEventWriterwrapping aSdkAlarmHistorianWriteBackendwith the same connection config the read path uses.Install-Services.ps1— appendsOTOPCUA_HISTORIAN_ALARM_WRITE_ENABLED=trueto the OtOpcUaWonderwareHistorian service env block. Read-only deployments flip it to false at service-config edit time without re-installing.HistorianFrameHandlersignature already acceptsIAlarmEventWriter?— supplying non-null at line 57 lights up the WriteAlarmEvents reply path that's been dormant since PR 3.3.Until PR D.1 pins the live aahClientManaged entry point, the
SdkAlarmHistorianWriteBackendreports RetryPlease for every event with a structured diagnostic. The lmxopcua-sideSqliteStoreAndForwardSinkretains queued events — same effective behaviour as today's NullAlarmHistorianSink fallback but with visible diagnostics rather than silent discard.Test plan
BuildAlarmWriterenv-var tests — unset / true / false / unrecognized / capitalization variantsFollow-up
SidecarAlarmHistorianWriter(theIAlarmHistorianWriterconsumer that drives WriteAlarmEvents frames now that the slot replies real outcomes).C:\publishservices.