fix: route debug stream events through ClusterClient site→central path
ClusterClient Sender refs are temporary proxies — valid for immediate reply but not durable for future Tells. Events now flow as DebugStreamEvent through SiteCommunicationActor → ClusterClient → CentralCommunicationActor → bridge actor (same pattern as health reports). Also fix DebugStreamHub to use IHubContext for long-lived callbacks instead of transient hub instance.
This commit is contained in:
@@ -85,6 +85,9 @@ public class CentralCommunicationActor : ReceiveActor
|
||||
|
||||
// Route enveloped messages to sites
|
||||
Receive<SiteEnvelope>(HandleSiteEnvelope);
|
||||
|
||||
// Route debug stream events from sites to the correct bridge actor
|
||||
Receive<Commons.Messages.DebugView.DebugStreamEvent>(HandleDebugStreamEvent);
|
||||
}
|
||||
|
||||
private void HandleHeartbeat(HeartbeatMessage heartbeat)
|
||||
@@ -93,6 +96,18 @@ public class CentralCommunicationActor : ReceiveActor
|
||||
Context.Parent.Tell(heartbeat);
|
||||
}
|
||||
|
||||
private void HandleDebugStreamEvent(Commons.Messages.DebugView.DebugStreamEvent msg)
|
||||
{
|
||||
if (_debugSubscriptions.TryGetValue(msg.CorrelationId, out var entry))
|
||||
{
|
||||
entry.Subscriber.Tell(msg.Event);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.Debug("No debug subscription found for correlationId {0}, dropping event", msg.CorrelationId);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleSiteHealthReport(SiteHealthReport report)
|
||||
{
|
||||
var aggregator = _serviceProvider.GetService<ICentralHealthAggregator>();
|
||||
|
||||
@@ -145,6 +145,13 @@ public class SiteCommunicationActor : ReceiveActor, IWithTimers
|
||||
_centralClient?.Tell(
|
||||
new ClusterClient.Send("/user/central-communication", msg), Self);
|
||||
});
|
||||
|
||||
// Internal: forward debug stream events to central (site→central streaming)
|
||||
Receive<DebugStreamEvent>(msg =>
|
||||
{
|
||||
_centralClient?.Tell(
|
||||
new ClusterClient.Send("/user/central-communication", msg), Self);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void PreStart()
|
||||
|
||||
Reference in New Issue
Block a user