refactor: rename ScadaLink → ZB.MOM.WW.ScadaBridge (code + projects + namespaces)
Solution + 23 src projects + 26 test projects renamed; folders, csproj, namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated. ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated. SQL roles/logins, LDAP domains, CLI command name, and CLI config dir (~/.scadalink → ~/.scadabridge) also renamed. Build green; 5 Host.Tests fail awaiting SQL login rename in next commit. Pre-existing StaleTagMonitor timing flakes unchanged. Rename script committed at tools/rename-to-scadabridge.sh.
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
using Akka.Actor;
|
||||
using Akka.Event;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.Host.Actors;
|
||||
|
||||
/// <summary>
|
||||
/// Subscribes to Akka.NET dead letter events, logs them, and tracks count
|
||||
/// for health monitoring integration.
|
||||
/// </summary>
|
||||
public class DeadLetterMonitorActor : ReceiveActor
|
||||
{
|
||||
private long _deadLetterCount;
|
||||
private readonly ISiteHealthCollector? _healthCollector;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the actor and registers dead-letter message handlers.
|
||||
/// </summary>
|
||||
/// <param name="logger">Logger for dead-letter events.</param>
|
||||
/// <param name="healthCollector">Optional health collector used to increment the dead-letter metric.</param>
|
||||
public DeadLetterMonitorActor(ILogger<DeadLetterMonitorActor> logger, ISiteHealthCollector? healthCollector = null)
|
||||
{
|
||||
_healthCollector = healthCollector;
|
||||
|
||||
Receive<DeadLetter>(dl =>
|
||||
{
|
||||
_deadLetterCount++;
|
||||
_healthCollector?.IncrementDeadLetter();
|
||||
logger.LogWarning(
|
||||
"Dead letter: {MessageType} from {Sender} to {Recipient}",
|
||||
dl.Message.GetType().Name,
|
||||
dl.Sender,
|
||||
dl.Recipient);
|
||||
});
|
||||
|
||||
Receive<GetDeadLetterCount>(_ => Sender.Tell(new DeadLetterCountResponse(_deadLetterCount)));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void PreStart()
|
||||
{
|
||||
Context.System.EventStream.Subscribe(Self, typeof(DeadLetter));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void PostStop()
|
||||
{
|
||||
Context.System.EventStream.Unsubscribe(Self, typeof(DeadLetter));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Message to request the current dead letter count.
|
||||
/// </summary>
|
||||
public sealed class GetDeadLetterCount
|
||||
{
|
||||
public static readonly GetDeadLetterCount Instance = new();
|
||||
private GetDeadLetterCount() { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Response containing the current dead letter count.
|
||||
/// </summary>
|
||||
public sealed record DeadLetterCountResponse(long Count);
|
||||
Reference in New Issue
Block a user