Interface ISqlServerCdcStateStore
Defines the contract for managing the state of Change Data Capture (CDC) processing.
public interface ISqlServerCdcStateStore : ICdcStateStore, IAsyncDisposable, IDisposable
- Inherited Members
Remarks
Extends the provider-neutral ICdcStateStore so SQL Server CDC state stores are conformable to the generic consumer-checkpoint contract (crash recovery, consumer tracking, progress monitoring) in addition to the SQL Server-specific LSN/sequence-value surface. The generic checkpoint rows share the same table, distinguished by empty database/table discriminators — mirroring the adapter pattern used by the Postgres, MongoDB, CosmosDB, DynamoDB, and Firestore state stores.
Methods
GetLastProcessedPositionAsync(string, string, CancellationToken)
Retrieves the last processed position for a specified database connection and name.
Task<IEnumerable<CdcProcessingState>> GetLastProcessedPositionAsync(string databaseConnectionIdentifier, string databaseName, CancellationToken cancellationToken)
Parameters
databaseConnectionIdentifierstringThe unique identifier for the database connection.
databaseNamestringThe name of the database to retrieve the processing state for.
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task<IEnumerable<CdcProcessingState>>
A task that represents the asynchronous operation, containing a collection of the last processed CdcProcessingState for each capture instance.
UpdateLastProcessedPositionAsync(string, string, string, byte[], byte[]?, DateTime?, long?, CancellationToken)
Updates the last processed position for a specified database connection and name.
Task<int> UpdateLastProcessedPositionAsync(string databaseConnectionIdentifier, string databaseName, string tableName, byte[] position, byte[]? sequenceValue, DateTime? commitTime, long? fencingToken, CancellationToken cancellationToken)
Parameters
databaseConnectionIdentifierstringThe unique identifier for the database connection.
databaseNamestringThe name of the database to update the processing state for.
tableNamestringThe name of the table to update the processing state for.
positionbyte[]The LSN position to set as the last processed position.
sequenceValuebyte[]The sequence value associated with the last processed position, if any.
commitTimeDateTime?The commit time of the last processed LSN.
fencingTokenlong?The current leadership tenure's fencing token, or null when leader-election fencing is not configured. When non-null, the checkpoint write is a non-decreasing compare-and-swap: it is applied only if the stored token is less than or equal to this token (a demoted leader presenting an older token is rejected, leaving the LSN checkpoint unchanged — no regression or skip). The return value is the number of rows written, so
0with a non-null token signals a superseded leader.cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.