Table of Contents

Class DynamoDbCdcStateStore

Namespace
Excalibur.Cdc.DynamoDb
Assembly
Excalibur.Cdc.DynamoDb.dll

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

dynamoClient IAmazonDynamoDB

The DynamoDB client.

options IOptions<DynamoDbCdcStateStoreOptions>

The CDC state store options.

logger ILogger<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

dynamoClient IAmazonDynamoDB

The DynamoDB client.

tableName string

The table name for storing CDC state.

logger ILogger<DynamoDbCdcStateStore>

The logger.

Methods

DeletePositionAsync(string, CancellationToken)

Deletes the saved position for a processor.

public Task DeletePositionAsync(string processorName, CancellationToken cancellationToken)

Parameters

processorName string

The unique processor name.

cancellationToken CancellationToken

A 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

processorName string

The unique processor name.

cancellationToken CancellationToken

A 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

processorName string

The unique processor name.

position DynamoDbCdcPosition

The position to save.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task

A task representing the asynchronous operation.