namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions;
///
/// Sink for driver-health state-change notifications. The runtime DI wires the
/// Akka-DistributedPubSub-backed implementation; tests and dev-stub paths use
/// to opt out without changing call sites.
///
public interface IDriverHealthPublisher
{
///
/// Publishes a health snapshot for one driver instance. Implementations must be
/// non-blocking and tolerant of being called from any thread.
///
/// The cluster the driver instance belongs to.
/// The driver instance the snapshot describes.
/// The current health snapshot.
/// The number of errors observed in the trailing 5-minute window.
///
/// When the driver last raised , or null if never
/// (or if it is not an ). Advisory: it prompts an operator to
/// re-browse, and never rebuilds the served address space.
///
/// The driver-supplied reason from that event; null when
/// is null.
void Publish(
string clusterId,
string driverInstanceId,
DriverHealth health,
int errorCount5Min,
DateTime? rediscoveryNeededUtc = null,
string? rediscoveryReason = null);
}
///
/// Drop-in no-op for tests and dev-stub paths. Production wires the Akka-backed
/// implementation in the Runtime project.
///
public sealed class NullDriverHealthPublisher : IDriverHealthPublisher
{
/// Singleton instance.
public static readonly NullDriverHealthPublisher Instance = new();
private NullDriverHealthPublisher() { }
///
public void Publish(
string clusterId,
string driverInstanceId,
DriverHealth health,
int errorCount5Min,
DateTime? rediscoveryNeededUtc = null,
string? rediscoveryReason = null)
{ /* no-op */ }
}