using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MxGateway.Contracts.Proto; namespace MxGateway.Server.Sessions; /// /// Gateway-side dispatcher seam for the alarm-RPC surface. Bridges the /// public AcknowledgeAlarm + QueryActiveAlarms gRPC handlers /// to the worker process that hosts IMxAccessAlarmConsumer. /// /// /// /// DI binds the production by /// default; it routes calls through the existing worker-pipe IPC. /// NotWiredAlarmRpcDispatcher is only the null fallback used /// when no dispatcher is registered (DI omission / standalone tests). /// Other tests inject a fake to exercise the gateway handler shape /// without spinning up a worker process. /// /// /// The dispatcher is session-scoped: every call resolves the /// session and forwards to that session's worker. The handler /// constructs the / /// stream from the dispatcher's /// output without further translation. /// /// public interface IAlarmRpcDispatcher { /// Forward an Acknowledge to the worker that owns the session. Task AcknowledgeAsync( AcknowledgeAlarmRequest request, CancellationToken cancellationToken); /// Walk active alarms on the worker that owns the session. IAsyncEnumerable QueryActiveAlarmsAsync( QueryActiveAlarmsRequest request, CancellationToken cancellationToken); }