namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions; /// /// Builds a per-driver-instance . The Runtime /// DriverHostActor consumes this factory (resolved from DI, like ) /// to attach a resilience invoker to each spawned DriverInstanceActor WITHOUT the actor /// assembly referencing ZB.MOM.WW.OtOpcUa.Core (which drags in Polly). The fused Host /// binds a concrete factory closing over the process-singleton pipeline builder + status tracker + /// driver-tier resolver; when unbound, yields the /// pass-through invoker so dispatch behaves exactly as before. /// public interface IDriverCapabilityInvokerFactory { /// /// Create the resilience invoker for one driver instance. The returned invoker is keyed on /// and applies the tier policy resolved from /// , layering any per-instance /// overrides on top. /// /// The driver instance identifier (pipeline + tracker key). /// The driver type name, used to resolve the resilience tier defaults. /// /// Optional per-instance DriverInstance.ResilienceConfig JSON (from the deployment artifact) /// layered on top of the tier defaults. null/empty ⇒ pure tier defaults. A concrete factory /// invalidates any cached pipelines for so a changed config /// applied across a driver respawn takes effect (the pipeline cache is keyed on instance/host/ /// capability, not options). /// /// A per-instance . IDriverCapabilityInvoker Create(string driverInstanceId, string driverType, string? resilienceConfigJson = null); } /// /// Returns for every driver instance. Bound /// when the fused Host hasn't registered a real resilience factory (Mac dev path, smoke tests, /// admin-only nodes). Dispatch then routes calls straight through with no pipeline. /// public sealed class NullDriverCapabilityInvokerFactory : IDriverCapabilityInvokerFactory { /// The shared singleton instance. public static readonly NullDriverCapabilityInvokerFactory Instance = new(); private NullDriverCapabilityInvokerFactory() { } /// public IDriverCapabilityInvoker Create(string driverInstanceId, string driverType, string? resilienceConfigJson = null) => NullDriverCapabilityInvoker.Instance; }