Path: redb-route/redb.Route/Configuration/ConsumerStartRetryOptions.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/ConsumerStartRetryOptions.cs
----
namespace redb.Route.Configuration;
///
/// Retry of a consumer that failed to start with its context (RedbRoute:ConsumerStartRetry), the back-off of
/// Apache Camel's supervising route controller. A broker or a server that is not up yet when the context starts
/// leaves the route Errored; the context then starts its consumer again in the background, with a pause that
/// grows from by up to , until it starts or
/// runs out. The route stays Errored while it waits, so health reports it.
///
public sealed class ConsumerStartRetryOptions
{
/// Whether a consumer that failed to start is started again. Default: true.
public bool Enabled { get; set; } = true;
/// Pause before the first retry (Camel backOffDelay). Default: 2 seconds.
public TimeSpan Delay { get; set; } = TimeSpan.FromSeconds(2);
/// Factor the pause grows by after each failed retry (Camel backOffMultiplier). Default: 2.
public double Multiplier { get; set; } = 2.0;
/// The longest pause between two retries (Camel backOffMaxDelay). Default: 1 minute.
public TimeSpan MaxDelay { get; set; } = TimeSpan.FromMinutes(1);
///
/// How many retries a consumer gets; 0 retries until the context stops (Camel backOffMaxAttempts).
/// After the last one the route stays Errored. Default: 0.
///
public int MaxAttempts { get; set; }
///
/// Whether an Errored route whose consumer waits for a start retry makes health Unhealthy (Camel
/// unhealthyOnRestarting); false reports it Degraded. Default: true, as in Camel since 4.7.
///
public bool UnhealthyOnRestarting { get; set; } = true;
///
/// Whether an Errored route no start retry waits for (the retries ran out, retry is off, or a route policy
/// refused the start) makes health Unhealthy (Camel unhealthyOnExhausted); false reports it Degraded.
/// Default: true, as in Camel since 4.7.
///
public bool UnhealthyOnExhausted { get; set; } = true;
///
/// Whether an Errored route makes health Unhealthy rather than Degraded:
/// while a start retry waits for it (), otherwise.
///
public bool ErroredRouteIsUnhealthy(bool retryPending) => retryPending ? UnhealthyOnRestarting : UnhealthyOnExhausted;
/// The pauses between retries: , grown by up to .
internal Core.BackoffSchedule Schedule => new(Delay, Multiplier, MaxDelay);
internal void Validate()
{
Core.BackoffSchedule.Validate("ConsumerStartRetry", Delay, Multiplier, MaxDelay);
if (MaxAttempts < 0)
throw new ArgumentOutOfRangeException(nameof(MaxAttempts), MaxAttempts,
"ConsumerStartRetry.MaxAttempts must be 0 (no limit) or more.");
}
}