Class CdcFatalErrorOptions<TEvent>
Options for configuring fatal-error handling during CDC processing for a provider whose change
events are of type TEvent.
public sealed class CdcFatalErrorOptions<TEvent> where TEvent : class
Type Parameters
TEventThe provider-specific change-event type.
- Inheritance
-
CdcFatalErrorOptions<TEvent>
- Inherited Members
Properties
AttemptStabilityThreshold
Gets or sets how long an attempt must stay up before its failure counts as the start of a new run rather than a continuation of the previous one.
public TimeSpan AttemptStabilityThreshold { get; set; }
Property Value
- TimeSpan
The stability threshold; defaults to one minute. Must be greater than zero.
Remarks
A quiet source is the case this exists for: a stream with nothing to confirm, disconnected by an idle timeout every few minutes, is healthy, and its failures must not accumulate towards MaxConsecutiveTransientFailures and stop the loop.
Independent of MaxReconnectDelay, and that separation is the fix. One option served both meanings, so a consumer who shortened the delay cap also shortened this threshold without being told. The default is one minute — the same value the delay cap defaults to — so a deployment that sets neither behaves exactly as before; only a deployment that had shortened the cap changes, and for it the change is the repair.
MaxConsecutiveTransientFailures
Gets or sets how many consecutive transient failures a streaming processor tolerates before it stops, or null to keep reconnecting for as long as the process runs.
public int? MaxConsecutiveTransientFailures { get; set; }
Property Value
Remarks
A failure the framework does not recognise is treated as transient, so a condition that never clears would otherwise be retried indefinitely. The retry always backs off (see MaxReconnectDelay) and the count is reported to the CDC health check whether or not a limit is set; this limit adds a stop.
On reaching the limit the processor stops through the same path as a fatal error: it invokes OnFatalError when one is set, and otherwise throws a CdcRetryExhaustedException carrying the last failure. The durable position is never advanced on the way out, so a restarted processor resumes where this one stopped.
A failure only counts if its attempt made no progress and stayed up for less than MaxReconnectDelay, so a quiet source disconnected by an idle timeout is not stopped.
Size the limit against your shutdown grace period. With a one-second base interval, five consecutive failures elapse in about thirty-one seconds, which is close to a typical termination grace period. During a rolling deployment the previous instance may still hold a resource (a replication slot, a lease) for that long, so a small limit can stop the new instance before the old one has released it.
MaxReconnectDelay
Gets or sets the longest delay between reconnect attempts after a transient failure.
public TimeSpan MaxReconnectDelay { get; set; }
Property Value
- TimeSpan
The maximum delay; defaults to one minute. Must be greater than zero.
Remarks
The delay starts at the provider's own polling or reconnect interval and doubles with each consecutive failure until it reaches this value. A value below the provider's own interval is raised to that interval.
This is ONLY the delay cap. It used to double as the threshold an attempt had to survive to count as stable, so shortening it to bound a reconnect storm also, invisibly, shortened how long a connection had to stay up before its failure started a new count — which silently bought extra retries past MaxConsecutiveTransientFailures. That threshold is now AttemptStabilityThreshold and is set independently.
OnFatalError
Gets or sets the delegate invoked when a fatal error occurs during CDC processing. When null, the processor rethrows the exception and stops processing (fail-loud — never a silent infinite retry).
public CdcFatalErrorHandler<TEvent>? OnFatalError { get; set; }
Property Value
- CdcFatalErrorHandler<TEvent>