Class CdcFatalGuard
The single, shared, pure decision point for a CDC consume loop's checkpoint-advance / stop
behavior on every iteration. Every provider's StartAsync loop routes its fatal-vs-transient
decision through Decide(Exception?, IMessageFailureClassifier?).
public static class CdcFatalGuard
- Inheritance
-
CdcFatalGuard
- Inherited Members
Remarks
The safety invariant — a fatal (or transient) fault never advances the durable checkpoint past the unprocessed change — is enforced by the idiom native to each provider class (see CdcFatalDecision): poll-batch providers (Cosmos, DynamoDb) gate the durable advance literally on AdvanceCheckpoint at a site reached on both the success and the captured-fault path; streaming providers (Postgres, Mongo) enforce it by confirm-site placement (the fault unwinds before the commit/invalidation confirm is reachable). A field-gate on a streaming confirm site would be vacuous, so it is not used there.
Decide(Exception?, IMessageFailureClassifier?) itself is pure and deterministic (no I/O), so the decision arms are directly and non-vacuously unit-testable. The end-to-end durability invariant is regression-locked by the poll-batch field-gate mutant test (Cosmos/DynamoDb) and the non-skipped real-infra restart-redelivery test (Postgres/Mongo).
Methods
Decide(Exception?, IMessageFailureClassifier?)
Decides the loop's action for one iteration from the outcome of processing a change/batch.
public static CdcFatalDecision Decide(Exception? exception, IMessageFailureClassifier? classifier)
Parameters
exceptionExceptionThe exception raised while processing the change/batch, or null when the iteration succeeded.
classifierIMessageFailureClassifierThe optional failure classifier deciding whether a fault is fatal (non-retryable); when null, the built-in CdcFatalClassifier defaults apply.
Returns
- CdcFatalDecision
On success (
exceptionis null) → advance + continue. On a fatal or unknown fault → do NOT advance, stop for review. On a transient fault → do NOT advance, reconnect.