Path: redb-route/redb.Route.File/FileEndpointOptions.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.File/FileEndpointOptions.cs
----
using redb.Route.GenericFile;
namespace redb.Route.File;
///
/// Options for file endpoints. Inherits shared options from
/// and adds local-file-specific read lock configuration.
/// URI: file:///C:/path?include=*.csv&delay=5000&noop=true
///
public class FileEndpointOptions : GenericFileEndpointOptions
{
// ── Read locking (local file only) ──────────────────────────────
/// Read lock strategy (default: None).
public ReadLockStrategy ReadLock { get; set; } = ReadLockStrategy.None;
/// Timeout in milliseconds for acquiring a read lock (default: 10000).
public long ReadLockTimeout { get; set; } = 10000;
/// Interval in milliseconds between read lock checks for 'Changed' strategy (default: 1000).
public int ReadLockCheckInterval { get; set; } = 1000;
/// Minimum age in milliseconds for 'Changed' strategy — file must be unchanged for this long (default: 1000).
public long ReadLockMinAge { get; set; } = 1000;
/// Extension used for marker file lock (default: ".redbLock").
public string ReadLockMarkerFileExtension { get; set; } = ".redbLock";
// ── Failure handling ────────────────────────────────────────────
///
/// Directory to move a file to when its processing fails (empty = disabled, the default).
/// Relative to the endpoint directory unless absolute; supports the same file tokens as
/// . Without it a failed file is left in place and
/// re-picked on the next poll; setting it quarantines poison files out of the poll directory.
///
public string MoveFailed { get; set; } = "";
// ── Producer safety ─────────────────────────────────────────────
///
/// If true, the producer refuses to write outside the endpoint directory (default: true).
/// File names usually arrive from the incoming message, so a "../" or absolute name would
/// otherwise escape the directory. Set to false only when writing outside is intended.
///
public bool JailStartingDirectory { get; set; } = true;
///
public override void Validate()
{
ValidateCommon();
GenericFileUtils.ValidateFileKeys("moveFailed", MoveFailed);
if (ReadLockCheckInterval <= 0)
throw new ArgumentOutOfRangeException(nameof(ReadLockCheckInterval), ReadLockCheckInterval,
"ReadLockCheckInterval must be positive.");
if (ReadLockMinAge < 0)
throw new ArgumentOutOfRangeException(nameof(ReadLockMinAge), ReadLockMinAge,
"ReadLockMinAge cannot be negative.");
if (ReadLockTimeout < 0)
throw new ArgumentOutOfRangeException(nameof(ReadLockTimeout), ReadLockTimeout,
"ReadLockTimeout cannot be negative.");
}
}