feat(mesh-phase5): tap the 4 telemetry publish seams into the local hub (DPS intact)
Each of the four telemetry publish seams now also emits its DPS payload into the node-local ITelemetryLocalHub (Phase 5), leaving the existing DistributedPubSub publish untouched: - driver-health AkkaDriverHealthPublisher -> TelemetryItem.Health - resilience DriverResilienceStatusPublisherService -> TelemetryItem.Resilience - alerts ScriptedAlarmHostActor + DriverHostActor (native) -> TelemetryItem.Alarm - script-logs VirtualTagActor + DpsScriptLogPublisher -> TelemetryItem.Script DI services take the hub as a required ctor param; actors take an optional nullable hub threaded through their Props and the real spawn sites (DriverHostActor <- ServiceCollectionExtensions; VirtualTagActor/ScriptedAlarmHostActor <- DriverHostActor), so existing test Props constructions keep compiling and simply do not emit. The hub is a no-op until a gRPC client subscribes, so the emit is safe on every node. Claude-Session: https://claude.ai/code/session_01GASWkNEi68FSCtvr6rLoEW
This commit is contained in:
+13
-3
@@ -4,6 +4,7 @@ using Shouldly;
|
||||
using Xunit;
|
||||
using ZB.MOM.WW.OtOpcUa.Commons.Messages.Logging;
|
||||
using ZB.MOM.WW.OtOpcUa.Runtime.Scripting;
|
||||
using ZB.MOM.WW.OtOpcUa.Runtime.Telemetry;
|
||||
using ZB.MOM.WW.OtOpcUa.Runtime.Tests.Harness;
|
||||
using ZB.MOM.WW.OtOpcUa.Runtime.VirtualTags;
|
||||
|
||||
@@ -40,7 +41,7 @@ public sealed class DpsScriptLogPublisherTests : RuntimeActorTestBase
|
||||
probe.Send(mediator, new Subscribe(VirtualTagActor.ScriptLogsTopic, probe.Ref));
|
||||
probe.ExpectMsg<SubscribeAck>(TimeSpan.FromSeconds(10));
|
||||
|
||||
var publisher = new DpsScriptLogPublisher(() => Sys);
|
||||
var publisher = new DpsScriptLogPublisher(() => Sys, new NoopHub());
|
||||
var entry = SampleEntry();
|
||||
|
||||
// The SubscribeAck confirms the subscribe was registered, but DPS topic membership is
|
||||
@@ -61,7 +62,7 @@ public sealed class DpsScriptLogPublisherTests : RuntimeActorTestBase
|
||||
public void Publish_does_not_throw_when_the_system_accessor_throws()
|
||||
{
|
||||
var publisher = new DpsScriptLogPublisher(
|
||||
() => throw new InvalidOperationException("system not ready"));
|
||||
() => throw new InvalidOperationException("system not ready"), new NoopHub());
|
||||
|
||||
Should.NotThrow(() => publisher.Publish(SampleEntry()));
|
||||
}
|
||||
@@ -70,6 +71,15 @@ public sealed class DpsScriptLogPublisherTests : RuntimeActorTestBase
|
||||
[Fact]
|
||||
public void Null_system_accessor_throws_ArgumentNullException()
|
||||
{
|
||||
Should.Throw<ArgumentNullException>(() => new DpsScriptLogPublisher(null!));
|
||||
Should.Throw<ArgumentNullException>(() => new DpsScriptLogPublisher(null!, new NoopHub()));
|
||||
}
|
||||
|
||||
/// <summary>No-op telemetry hub for the publisher tests (the hub tap is asserted in
|
||||
/// <c>PublishSeamEmitsToHubTests</c>; here it must simply not interfere).</summary>
|
||||
private sealed class NoopHub : ITelemetryLocalHub
|
||||
{
|
||||
public void Emit(TelemetryItem item) { }
|
||||
|
||||
public ITelemetrySubscription Subscribe(int boundedCapacity) => throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user