Class DynamoDbCdcStateStore
DynamoDB-backed state store for CDC position tracking.
public sealed class DynamoDbCdcStateStore : IDynamoDbCdcStateStore, ICdcStateStore, IAsyncDisposable, IDisposable
- Inheritance
-
DynamoDbCdcStateStore
- Implements
- Inherited Members
Remarks
Uses a DynamoDB table to store CDC positions. The table should have a primary key 'pk' (string) for the processor name.
Constructors
DynamoDbCdcStateStore(IAmazonDynamoDB, IOptions<DynamoDbCdcStateStoreOptions>, ILogger<DynamoDbCdcStateStore>)
Initializes a new instance of the DynamoDbCdcStateStore class with options.
public DynamoDbCdcStateStore(IAmazonDynamoDB dynamoClient, IOptions<DynamoDbCdcStateStoreOptions> options, ILogger<DynamoDbCdcStateStore> logger)
Parameters
dynamoClientIAmazonDynamoDBThe DynamoDB client.
optionsIOptions<DynamoDbCdcStateStoreOptions>The CDC state store options.
loggerILogger<DynamoDbCdcStateStore>The logger.
DynamoDbCdcStateStore(IAmazonDynamoDB, string, ILogger<DynamoDbCdcStateStore>)
Initializes a new instance of the DynamoDbCdcStateStore class.
public DynamoDbCdcStateStore(IAmazonDynamoDB dynamoClient, string tableName, ILogger<DynamoDbCdcStateStore> logger)
Parameters
dynamoClientIAmazonDynamoDBThe DynamoDB client.
tableNamestringThe table name for storing CDC state.
loggerILogger<DynamoDbCdcStateStore>The logger.
Methods
DeletePositionAsync(string, CancellationToken)
Deletes the saved position for a processor.
public Task DeletePositionAsync(string processorName, CancellationToken cancellationToken)
Parameters
processorNamestringThe unique processor name.
cancellationTokenCancellationTokenA token to observe for cancellation requests.
Returns
- Task
A task representing the asynchronous operation.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
GetPositionAsync(string, CancellationToken)
Gets the last saved position for a processor.
public Task<DynamoDbCdcPosition?> GetPositionAsync(string processorName, CancellationToken cancellationToken)
Parameters
processorNamestringThe unique processor name.
cancellationTokenCancellationTokenA token to observe for cancellation requests.
Returns
- Task<DynamoDbCdcPosition>
The last saved position, or null if no position exists.
SavePositionAsync(string, DynamoDbCdcPosition, CancellationToken)
Saves the current position for a processor.
public Task SavePositionAsync(string processorName, DynamoDbCdcPosition position, CancellationToken cancellationToken)
Parameters
processorNamestringThe unique processor name.
positionDynamoDbCdcPositionThe position to save.
cancellationTokenCancellationTokenA token to observe for cancellation requests.
Returns
- Task
A task representing the asynchronous operation.