7fd5cb2b56
ClusterClient→gRPC migration Phase 4 (docs/plans/2026-07-22-clusterclient-to-grpc-plan.md). Phases 2/3 proved both directions on gRPC; this removes the Akka transport underneath. Deleted: - AkkaCentralTransport, AkkaSiteTransport (+ their dedicated tests) - ISiteClientFactory + DefaultSiteClientFactory; CentralCommunicationActor legacy ctor + SelectTransport (Host now builds GrpcSiteTransport and injects it) - ClusterClient creation + both ClusterClientReceptionist.RegisterService calls in AkkaHostedService; the RegisterCentralClient message + receive block - CommunicationOptions.CentralContactPoints; the CentralTransport/SiteTransport coexistence flags; the CentralTransportMode/SiteTransportKind enums gRPC is now the only site↔central transport (site→central CentralControlService via GrpcCentralTransport; central→site SiteCommandService via GrpcSiteTransport), both built unconditionally by the Host. NoOpCentralTransport is the fail-loud null-default so TestKit command-dispatch suites still construct the site actor without a wired transport; production always injects GrpcCentralTransport. Config: CentralGrpcEndpoints is now unconditional — CommunicationOptionsValidator rejects blank entries (role-agnostic), and StartupValidator requires a Site node to list >=1 endpoint (fail-fast, mirrors GrpcPsk). Rig configs moved CentralContactPoints -> CentralGrpcEndpoints (docker x6, docker-env2 x2, Host default, deploy/wonder-app-vd03). Kept Akka.Cluster.Tools (ClusterSingleton still used). Tests: build 0/0; Communication.Tests 640, Host.Tests 421 green. Removed the ClusterClient.Send per-site-routing tests (covered by the transport suites), swapped the ISiteClientFactory-based ctors to a substitute ISiteCommandTransport, converted the audit-push integration relay to an in-process bridge transport. Docs: Component-Communication/Host/StoreAndForward, components/Communication, topology-guide, grpc_streams (SUPERSEDED note), the frame-size known-issue (retired amendment), and CLAUDE.md transport decisions. Not included: the dead IntegrationCallRequest path (#32) is a separate user-owned behavioral decision — SiteEnvelope routing is transport-agnostic so it still compiles.
78 lines
4.8 KiB
C#
78 lines
4.8 KiB
C#
using Akka.Actor;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Messages.Audit;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Messages.Deployment;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Messages.Health;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Messages.Notification;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.Communication.Actors;
|
|
|
|
/// <summary>
|
|
/// The site→central transport seam: one method per the seven messages
|
|
/// <see cref="SiteCommunicationActor"/> sends to <c>/user/central-communication</c> today.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The actor's receive handlers no longer own the wire plumbing — they capture the current
|
|
/// <c>Sender</c> and hand it to the transport as <paramref name="replyTo"/>. The production
|
|
/// implementation is <see cref="Grpc.GrpcCentralTransport"/> (a gRPC dial of
|
|
/// <c>CentralControlService</c> with sticky central-a→central-b failover) — the only site→central
|
|
/// transport since the ClusterClient→gRPC migration removed the Akka path in Phase 4.
|
|
/// <see cref="NoOpCentralTransport"/> is the fail-loud placeholder used only when the Host injects
|
|
/// nothing (a wiring bug, and in TestKit suites that only exercise command dispatch).
|
|
/// </para>
|
|
/// <para>
|
|
/// <b>Reply/fault contract.</b> Each Ask-returning method (all but the heartbeat) guarantees exactly
|
|
/// one reply eventually lands at <paramref name="replyTo"/>: either the real reply type the caller
|
|
/// Asks for, or a transient-failure signal. The gRPC path sends <see cref="Status.Failure"/> on any
|
|
/// non-OK status (a timeout or an <c>Unavailable</c> that could not be failed over) — what the
|
|
/// S&F / audit / health layers above the seam already treat as transient (rows stay buffered,
|
|
/// counters restore, the pass re-runs).
|
|
/// </para>
|
|
/// <para>
|
|
/// <b>The heartbeat stays fire-and-forget end-to-end.</b> <see cref="SendHeartbeat"/> takes no
|
|
/// <c>replyTo</c> and never surfaces a fault: a transport failure is swallowed and logged, exactly
|
|
/// as the old <c>Tell</c> dropped it. A failing heartbeat must never fault the site's heartbeat
|
|
/// timer path.
|
|
/// </para>
|
|
/// </remarks>
|
|
public interface ICentralTransport
|
|
{
|
|
/// <summary>Forwards a buffered notification; central replies <see cref="NotificationSubmitAck"/> to <paramref name="replyTo"/>.</summary>
|
|
/// <param name="message">The notification submission.</param>
|
|
/// <param name="replyTo">The actor (the S&F forwarder's Ask) the ack routes back to.</param>
|
|
void SubmitNotification(NotificationSubmit message, IActorRef replyTo);
|
|
|
|
/// <summary>Forwards a Notify.Status query; central replies <see cref="NotificationStatusResponse"/> to <paramref name="replyTo"/>.</summary>
|
|
/// <param name="message">The status query.</param>
|
|
/// <param name="replyTo">The actor (the Notify helper's Ask) the response routes back to.</param>
|
|
void QueryNotificationStatus(NotificationStatusQuery message, IActorRef replyTo);
|
|
|
|
/// <summary>Pushes a batch of audit events; central replies <see cref="IngestAuditEventsReply"/> to <paramref name="replyTo"/>.</summary>
|
|
/// <param name="message">The audit-event ingest command.</param>
|
|
/// <param name="replyTo">The actor (the telemetry drain's Ask) the reply routes back to.</param>
|
|
void IngestAuditEvents(IngestAuditEventsCommand message, IActorRef replyTo);
|
|
|
|
/// <summary>Pushes a batch of combined cached-call telemetry; central replies <see cref="IngestCachedTelemetryReply"/> to <paramref name="replyTo"/>.</summary>
|
|
/// <param name="message">The cached-telemetry ingest command.</param>
|
|
/// <param name="replyTo">The actor (the telemetry drain's Ask) the reply routes back to.</param>
|
|
void IngestCachedTelemetry(IngestCachedTelemetryCommand message, IActorRef replyTo);
|
|
|
|
/// <summary>Reports a node's startup inventory; central replies <see cref="ReconcileSiteResponse"/> to <paramref name="replyTo"/>.</summary>
|
|
/// <param name="message">The reconcile request.</param>
|
|
/// <param name="replyTo">The actor (the reconciliation Ask) the response routes back to.</param>
|
|
void ReconcileSite(ReconcileSiteRequest message, IActorRef replyTo);
|
|
|
|
/// <summary>Reports periodic site health; central replies <see cref="SiteHealthReportAck"/> to <paramref name="replyTo"/>.</summary>
|
|
/// <param name="message">The health report.</param>
|
|
/// <param name="replyTo">The actor (the health transport's Ask) the ack routes back to.</param>
|
|
void ReportSiteHealth(SiteHealthReport message, IActorRef replyTo);
|
|
|
|
/// <summary>
|
|
/// Sends an application heartbeat, fire-and-forget. Never replies and never faults; a failure
|
|
/// is swallowed and logged.
|
|
/// </summary>
|
|
/// <param name="message">The heartbeat.</param>
|
|
/// <param name="self">The site communication actor, used as the sender on the Akka path (ignored on gRPC).</param>
|
|
void SendHeartbeat(HeartbeatMessage message, IActorRef self);
|
|
}
|