9c631b47e1
Adds an additive, site-wide, alarm-only gRPC stream backing the aggregated
Alarm Summary. Proto: new SiteStreamRequest { correlation_id } message + rpc
SubscribeSite(SiteStreamRequest) returns (stream SiteStreamEvent) on
SiteStreamService — purely additive, no field renumbering. Regenerated the
checked-in SiteStreamGrpc/*.cs.
Server: SubscribeInstance and the new SubscribeSite now delegate to a shared
RunSubscriptionStreamAsync helper (readiness/shutdown guards, correlation-id
validation, duplicate replacement, concurrency cap, bounded DropOldest channel,
relay actor, SiteConnectionOpened/Closed telemetry, guaranteed cleanup). The
only variation is the subscribe delegate: SubscribeSite calls
ISiteStreamSubscriber.SubscribeSiteAlarms (no per-instance filter). Added
SubscribeSiteAlarms to the ISiteStreamSubscriber contract (SiteStreamManager
already implements it from T1). StreamRelayActor reused unchanged — it already
drops IsConfiguredPlaceholder rows and maps the enriched AlarmStateUpdate.
Tests: SubscribeSite subscribes site alarms + removes on cancel, rejects unsafe
correlation ids, and relays a domain AlarmStateChanged as a proto
AlarmStateUpdate on the stream.
Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj
36 lines
1.6 KiB
C#
36 lines
1.6 KiB
C#
using Akka.Actor;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.Communication.Grpc;
|
|
|
|
/// <summary>
|
|
/// Abstraction over the site-side stream subscription mechanism.
|
|
/// SiteStreamManager in the SiteRuntime project implements this interface;
|
|
/// the gRPC server depends on it without referencing SiteRuntime directly.
|
|
/// </summary>
|
|
public interface ISiteStreamSubscriber
|
|
{
|
|
/// <summary>
|
|
/// Subscribes an actor to receive filtered stream events for a specific instance.
|
|
/// </summary>
|
|
/// <param name="instanceName">The unique name of the instance whose events to subscribe to.</param>
|
|
/// <param name="subscriber">The actor reference that will receive stream event messages.</param>
|
|
/// <returns>A subscription ID that can be used for unsubscription.</returns>
|
|
string Subscribe(string instanceName, IActorRef subscriber);
|
|
|
|
/// <summary>
|
|
/// Subscribes an actor to receive ALARM events for ALL instances on the site
|
|
/// (no per-instance filter). Only <c>AlarmStateChanged</c> events are
|
|
/// forwarded; attribute-value events are dropped. Backs the site-wide
|
|
/// <c>SubscribeSite</c> gRPC stream used by the aggregated Alarm Summary.
|
|
/// </summary>
|
|
/// <param name="subscriber">The actor reference that will receive alarm stream event messages.</param>
|
|
/// <returns>A subscription ID that can be used for unsubscription.</returns>
|
|
string SubscribeSiteAlarms(IActorRef subscriber);
|
|
|
|
/// <summary>
|
|
/// Removes all subscriptions for the given actor.
|
|
/// </summary>
|
|
/// <param name="subscriber">The actor reference whose subscriptions should be removed.</param>
|
|
void RemoveSubscriber(IActorRef subscriber);
|
|
}
|