Table of Contents

Enum StalePositionRecoveryStrategy

Namespace
Excalibur.Cdc
Assembly
Excalibur.Cdc.dll

Specifies the recovery strategy to use when the saved CDC position is no longer valid.

public enum StalePositionRecoveryStrategy

Fields

FallbackToEarliest = 1

Reset to the earliest available position in the CDC change tables.

This is the safest automatic recovery option. The processor will resume from the minimum available position, which may result in reprocessing events that were already handled.

Consumers should implement idempotent handlers to handle potential duplicates.

FallbackToLatest = 2

Skip to the latest available position, potentially losing unprocessed changes.

Use with caution: This strategy may result in data loss if there are unprocessed changes between the stale position and the current maximum position.

This option is appropriate only when missing changes can be tolerated or when the application has other mechanisms to detect and recover from gaps.

InvokeCallback = 3

Invoke the configured callback to let the consumer decide how to handle the stale position.

When this strategy is selected, the OnPositionReset callback must be configured. The callback receives detailed information about the stale position and can implement custom recovery logic.

If the callback is not configured and this strategy is selected, the processor will throw an InvalidOperationException.

Throw = 0

Throw an exception when a stale position is detected.

This is the legacy behavior. The processor will stop and propagate the exception, requiring manual intervention to resolve the position mismatch.

Remarks

A stale position scenario occurs when the saved position (e.g., LSN for SQL Server) no longer exists in the CDC change tables. This can happen due to:

  • CDC cleanup job purging records past the saved position
  • Database restore from backup where the max position is lower than saved
  • CDC being disabled and re-enabled on the database
  • Lower environment database copy with different CDC history