Path: redb-route/redb.Route/Configuration/ReconnectOptions.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/Configuration/ReconnectOptions.cs
----
namespace redb.Route.Configuration;
///
/// Reconnect after a connection or a link is lost while a route runs (RedbRoute:Reconnect). The start of a
/// consumer has its own retry (); this one keeps the route Started and
/// reports the loss through the endpoint's health. Used by every connector that reports its connections to a
/// .
///
public sealed class ReconnectOptions
{
/// Pause before the first attempt after a loss. Default: 1 second.
public TimeSpan Delay { get; set; } = TimeSpan.FromSeconds(1);
/// Factor the pause grows by after each failed attempt. Default: 2.
public double Multiplier { get; set; } = 2.0;
/// The longest pause between two attempts. Default: 30 seconds.
public TimeSpan MaxDelay { get; set; } = TimeSpan.FromSeconds(30);
///
/// The longest wait for one connect of an attempt. A connect that has not finished by then counts as failed, and a
/// connection it still opens later is closed. Guards against clients whose connect can hang. Default: 30 seconds.
///
public TimeSpan AttemptTimeout { get; set; } = TimeSpan.FromSeconds(30);
///
/// How long a loss is reported as health Warning before it turns Critical, for clients that heal short blips by
/// themselves. Default: zero, so the first failed attempt makes the endpoint Critical (and the route Unhealthy when
/// the endpoint is its source).
///
public TimeSpan WarningPeriod { get; set; } = TimeSpan.Zero;
/// The pauses between attempts: , grown by up to .
internal Core.BackoffSchedule Schedule => new(Delay, Multiplier, MaxDelay);
internal void Validate()
{
Core.BackoffSchedule.Validate("Reconnect", Delay, Multiplier, MaxDelay);
if (AttemptTimeout <= TimeSpan.Zero || AttemptTimeout.TotalMilliseconds > int.MaxValue)
throw new ArgumentOutOfRangeException(nameof(AttemptTimeout), AttemptTimeout,
"Reconnect.AttemptTimeout must be positive and not exceed 24 days.");
if (WarningPeriod < TimeSpan.Zero)
throw new ArgumentOutOfRangeException(nameof(WarningPeriod), WarningPeriod,
"Reconnect.WarningPeriod must not be negative.");
}
}