/* ======================================================================== * Copyright (c) 2005-2025 The OPC Foundation, Inc. All rights reserved. * * OPC Foundation MIT License 1.00 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * The complete license agreement can be found here: * http://opcfoundation.org/License/MIT/1.00/ * ======================================================================*/ using System; namespace Opc.Ua.Server.Fluent { /// /// Optional knobs for /// EventNotifierBuilderExtensions.Publish. /// /// /// /// All properties are init-only so the same options instance can safely be /// reused across multiple Publish registrations. /// /// /// Default behavior (no options supplied): lazy activation, default-field /// population enabled, error policy logs and continues, not registered as /// a root notifier. /// /// public sealed record EventPublishOptions { /// /// When true, the source's iterator is pumped immediately at /// builder seal time and stays active until the manager disposes — /// regardless of whether any client is monitoring the node. Useful /// for diagnostic event streams whose backpressure or history-storage /// guarantees must be preserved across reconnect storms. Default /// false (lazy activation: events are pulled only while /// is true). /// public bool AlwaysOn { get; init; } /// /// When true, the registry does NOT auto-populate /// EventId, EventType, SourceNode, /// SourceName, Time, ReceiveTime, /// Severity, and Message on each yielded event. Use /// this when your iterator emits fully-populated events /// (e.g. replayed from a history store). Default false /// (matches BaseEventState.Initialize). /// public bool SkipDefaultPopulation { get; init; } /// /// When true, the notifier node is added to the manager's /// root-notifier collection so its events propagate to clients that /// subscribe to the Server object. Default false: /// only direct subscribers to the notifier (or to an ancestor that /// the notifier is reachable from via inverse HasNotifier /// references) receive events. /// /// /// Enabling this option overwrites the notifier's /// with the manager's /// root-notifier handler, which is incompatible with attaching an /// OnEvent interceptor or with direct per-node event monitored /// items on the same notifier; the runtime emits a debug-level log /// line documenting the trade-off. /// public bool RegisterAsRootNotifier { get; init; } /// /// Maximum time the registry waits for the iterator to honor its /// when the source /// deactivates or the manager disposes. After the timeout, the source /// is flagged as leaked: any further events the iterator yields are /// silently dropped. Default 5 seconds. /// public TimeSpan CancellationTimeout { get; init; } = TimeSpan.FromSeconds(5); /// /// Optional sink that observes exceptions thrown by the factory /// invocation, the iterator MoveNextAsync call, or /// . The registry already logs at /// Error level using the manager's logger; this hook is for /// callers that want to bubble the exception into their own /// telemetry. Default null. /// public Action? OnError { get; init; } } }