Path: redb-route/redb.Route.GenericFile/RemoteFileEndpointOptions.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.GenericFile/RemoteFileEndpointOptions.cs ---- using redb.Route.Core; namespace redb.Route.GenericFile; /// /// Base endpoint options for remote file-based transports (SFTP, FTP). /// Extends with connection parameters, /// reconnection logic, and remote-specific consumer features. /// public abstract class RemoteFileEndpointOptions : GenericFileEndpointOptions { // ═══════════════════════════════════════════════════════════════════ // CONNECTION // ═══════════════════════════════════════════════════════════════════ /// Remote server hostname or IP address. (default: localhost) public string Host { get; set; } = "localhost"; /// Remote server port. Subclass should set the protocol-specific default. public virtual int Port { get; set; } /// /// Named from the route registry. Lets server /// credentials live in the registry instead of the endpoint URI, so they never reach logs /// or dashboards. Typed as the common base, which every remote-file connector's factory derives from: the /// check gate refuses a bean of any other class; the connector itself asks for its own factory type. /// [RegistryReference(typeof(RemoteFileConnectionFactory))] public string? ConnectionFactory { get; set; } /// Username for authentication. public string Username { get; set; } = ""; /// Password for authentication. [Sensitive] public string Password { get; set; } = ""; /// TCP connection timeout in milliseconds. (default: 30000 = 30 s) public int ConnectionTimeout { get; set; } = 30_000; /// Operation timeout in milliseconds (read/write/list). (default: 60000 = 60 s) public int OperationTimeout { get; set; } = 60_000; // ═══════════════════════════════════════════════════════════════════ // RECONNECTION // ═══════════════════════════════════════════════════════════════════ /// Maximum number of automatic reconnect attempts after a disconnect. (default: 3) public int MaximumReconnectAttempts { get; set; } = 3; /// Delay in milliseconds between reconnect attempts. (default: 1000) public int ReconnectDelay { get; set; } = 1000; /// /// If true, disconnect after each poll cycle (consumer) or each upload (producer). /// Reduces open connections at the cost of latency. (default: false) /// public bool Disconnect { get; set; } // ═══════════════════════════════════════════════════════════════════ // CONSUMER: Remote-specific // ═══════════════════════════════════════════════════════════════════ /// Maximum file age in milliseconds. Files older than this are skipped. 0 = no limit. (default: 0) public long MaxAge { get; set; } /// Directory to move files to on processing failure. Empty = leave in place. public string MoveFailed { get; set; } = ""; /// /// If true, the starting (base) directory must exist on the remote server. /// Throws if it doesn't. (default: false) /// public bool StartingDirectoryMustExist { get; set; } /// /// If true, the consumer creates an empty exchange when a poll returns no files. /// Useful for heartbeat-style monitoring. (default: false) /// public bool SendEmptyMessageWhenIdle { get; set; } // ═══════════════════════════════════════════════════════════════════ // VALIDATION // ═══════════════════════════════════════════════════════════════════ /// /// Validates remote-specific options. Subclasses should call this from their Validate() method. /// protected void ValidateRemote() { ValidateCommon(); GenericFileUtils.ValidateFileKeys("moveFailed", MoveFailed); if (string.IsNullOrWhiteSpace(Host)) throw new ArgumentException("Host must be specified."); if (Port is < 1 or > 65535) throw new ArgumentOutOfRangeException(nameof(Port), Port, "Port must be 1–65535."); if (MaxAge < 0) throw new ArgumentOutOfRangeException(nameof(MaxAge), MaxAge, "MaxAge cannot be negative."); if (ConnectionTimeout < 0) throw new ArgumentOutOfRangeException(nameof(ConnectionTimeout), ConnectionTimeout, "ConnectionTimeout cannot be negative."); if (OperationTimeout < 0) throw new ArgumentOutOfRangeException(nameof(OperationTimeout), OperationTimeout, "OperationTimeout cannot be negative."); if (MaximumReconnectAttempts < 0) throw new ArgumentOutOfRangeException(nameof(MaximumReconnectAttempts), MaximumReconnectAttempts, "MaximumReconnectAttempts cannot be negative."); if (ReconnectDelay < 0) throw new ArgumentOutOfRangeException(nameof(ReconnectDelay), ReconnectDelay, "ReconnectDelay cannot be negative."); } }