dc9c0c950c
Apply the ZB.MOM.WW. prefix to all gateway-side projects, folders,
.csproj/.sln contents, C# namespaces, using directives, generated proto
C# (csharp_namespace + checked-in generated files), InternalsVisibleTo
attributes, project-name string literals (LoadProject, .sln lookups,
worker exe paths, staticwebassets manifest), and the install/script/doc
references that point at any of the above. Migrate the solution from
.sln to .slnx via `dotnet sln migrate` and delete the old file.
External-runtime identifiers are intentionally NOT prefixed so external
configuration keeps working:
- GatewayMetrics.cs MeterName ("MxGateway.Server")
- DashboardAuthenticationDefaults Scheme/Policy ("MxGateway.Dashboard")
- GatewayRequestLoggingMiddleware logger category ("MxGateway.Request")
- StaRuntime thread name ("MxGateway.Worker.STA")
- appsettings.json root section "MxGateway" + env-var prefix
MxGateway__... and secret-name MxGateway:ApiKeyPepper
- C:\ProgramData\MxGateway\ data dir paths
Also fixes two tests that were not rename-related but became visible
while validating the rename:
- WorkerLiveMxAccessSmokeTests.ShutDownAsync: cancellation that the
gateway service correctly maps to RpcException(Cancelled) per gRPC
convention was being misclassified as a stream fault. Added a sibling
catch on RpcException with StatusCode.Cancelled.
- IntegrationTestEnvironment.ResolveRepositoryRoot: extracted IsRepositoryRoot
and made it accept either a .git marker OR a .sln/.slnx next to src/
so the worker-exe walker works in non-git working copies.
clients/proto/proto-inputs.json's protoRoot updated to point at
src/ZB.MOM.WW.MxGateway.Contracts/Protos.
Verified by `dotnet build` and a full `dotnet test` of the .slnx with
MXGATEWAY_RUN_LIVE_{MXACCESS,LDAP,GALAXY}_TESTS=1:
Tests: 472/472 pass
Worker.Tests: 280/280 pass (4 dev-rig [Fact(Skip=...)] skipped)
IntegrationTests: 18/18 pass
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
64 lines
2.6 KiB
C#
64 lines
2.6 KiB
C#
using ZB.MOM.WW.MxGateway.Contracts.Proto;
|
|
|
|
namespace ZB.MOM.WW.MxGateway.Server.Alarms;
|
|
|
|
/// <summary>Lifecycle state of the gateway's central alarm monitor.</summary>
|
|
public enum GatewayAlarmMonitorState
|
|
{
|
|
/// <summary>Alarm monitoring is switched off (<c>MxGateway:Alarms:Enabled</c> is false).</summary>
|
|
Disabled,
|
|
|
|
/// <summary>The monitor is opening or re-opening its worker session.</summary>
|
|
Starting,
|
|
|
|
/// <summary>The monitor is connected and tracking the active-alarm set.</summary>
|
|
Monitoring,
|
|
|
|
/// <summary>The monitor's last lifecycle attempt failed; a restart is pending.</summary>
|
|
Faulted,
|
|
}
|
|
|
|
/// <summary>
|
|
/// The gateway's always-on alarm broker. A single gateway-owned worker
|
|
/// session monitors the AVEVA alarm provider; this service caches the
|
|
/// current active-alarm set and fans it out to any number of clients —
|
|
/// no client needs to open its own worker session to see alarms.
|
|
/// </summary>
|
|
public interface IGatewayAlarmService
|
|
{
|
|
/// <summary>Current monitor lifecycle state.</summary>
|
|
GatewayAlarmMonitorState State { get; }
|
|
|
|
/// <summary>Diagnostic message from the most recent fault, or null.</summary>
|
|
string? LastError { get; }
|
|
|
|
/// <summary>Process id of the worker backing the monitor, when one is attached.</summary>
|
|
int? WorkerProcessId { get; }
|
|
|
|
/// <summary>A point-in-time copy of the current active-alarm set.</summary>
|
|
IReadOnlyList<ActiveAlarmSnapshot> CurrentAlarms { get; }
|
|
|
|
/// <summary>
|
|
/// Attaches to the central alarm feed. The returned stream yields one
|
|
/// <see cref="AlarmFeedMessage"/> per currently-active alarm, then a
|
|
/// single <c>snapshot_complete</c> sentinel, then a <c>transition</c>
|
|
/// for every subsequent change.
|
|
/// </summary>
|
|
/// <param name="alarmFilterPrefix">Optional alarm-reference prefix scoping the feed.</param>
|
|
/// <param name="cancellationToken">Token that ends the subscription.</param>
|
|
IAsyncEnumerable<AlarmFeedMessage> StreamAsync(
|
|
string? alarmFilterPrefix,
|
|
CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Acknowledges an alarm through the monitor's worker session. Never
|
|
/// throws — transport and monitor-state failures surface in the
|
|
/// reply's <see cref="AcknowledgeAlarmReply.ProtocolStatus"/>.
|
|
/// </summary>
|
|
/// <param name="request">The acknowledge request.</param>
|
|
/// <param name="cancellationToken">Token to cancel the call.</param>
|
|
Task<AcknowledgeAlarmReply> AcknowledgeAsync(
|
|
AcknowledgeAlarmRequest request,
|
|
CancellationToken cancellationToken);
|
|
}
|