refactor(inbound-api): use the shared ZB.MOM.WW.Health IActiveNodeGate (ScadaBridge#80)
The InboundAPI carried its own IActiveNodeGate (implemented by Host/Health/ActiveNodeGate) whose rule already matched the shared Health 0.3.0 AkkaActiveNodeGate — both route to ClusterActiveNode (oldest Up member). The private interface and implementation are deleted; InboundAPI references ZB.MOM.WW.Health (0.3.0, already pinned) and InboundApiEndpointFilter, AuditWriteMiddleware, InboundMethodWarmupService and FlowDebugRunner consume ZB.MOM.WW.Health.IActiveNodeGate. The Central branch of Program.cs registers AkkaActiveNodeGate (unscoped, like the active-node health check). Warm-up behaviour is kept: the shared gate answers false while no ActorSystem resolves, while this member is not Up, and on any cluster-init fault. It resolves the ActorSystem through the existing DI singleton bridge (GetOrCreateActorSystem), the same path the health probes use. Tests: CompositionRoot asserts the shared gate type (fails with the registration removed); the evaluator wiring test now drives AkkaActiveNodeGate; new warm-up test (no ActorSystem -> not active). Nothing was missing from the Health 0.3.0 package. (ScadaBridge#80) Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
@@ -93,7 +93,12 @@ akka {{
|
||||
while (cluster.SelfMember.Status != Akka.Cluster.MemberStatus.Up && DateTime.UtcNow < deadline)
|
||||
await Task.Delay(100);
|
||||
|
||||
var gate = new ActiveNodeGate(akkaService);
|
||||
// Gitea #80: the inbound API's gate is the shared AkkaActiveNodeGate, resolving the
|
||||
// ActorSystem from DI exactly as Program.cs's singleton bridge serves it.
|
||||
using var sp = new ServiceCollection()
|
||||
.AddSingleton(_ => akkaService.GetOrCreateActorSystem())
|
||||
.BuildServiceProvider();
|
||||
var gate = new ZB.MOM.WW.Health.Akka.AkkaActiveNodeGate(sp);
|
||||
var provider = new AkkaClusterNodeProvider(akkaService, "Central");
|
||||
Assert.True(gate.IsActiveNode);
|
||||
Assert.True(provider.SelfIsPrimary);
|
||||
@@ -104,6 +109,17 @@ akka {{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gitea #80 warm-up contract: while no ActorSystem is available the shared gate reports
|
||||
/// standby, never active — the safe default the retired ScadaBridge gate also had.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ActiveNodeGate_WithoutActorSystem_IsNotActive()
|
||||
{
|
||||
using var sp = new ServiceCollection().BuildServiceProvider();
|
||||
Assert.False(new ZB.MOM.WW.Health.Akka.AkkaActiveNodeGate(sp).IsActiveNode);
|
||||
}
|
||||
|
||||
private static int FreePort()
|
||||
{
|
||||
var l = new System.Net.Sockets.TcpListener(System.Net.IPAddress.Loopback, 0);
|
||||
|
||||
Reference in New Issue
Block a user