Class MongoDbCdcStateStore
MongoDB implementation of IMongoDbCdcStateStore using a state collection.
public sealed class MongoDbCdcStateStore : IMongoDbCdcStateStore, ICdcStateStore, IAsyncDisposable, IDisposable
- Inheritance
-
MongoDbCdcStateStore
- Implements
- Inherited Members
Constructors
MongoDbCdcStateStore(IMongoClient, IOptions<MongoDbCdcStateStoreOptions>)
Initializes a new instance of the MongoDbCdcStateStore class with an existing client and options.
public MongoDbCdcStateStore(IMongoClient client, IOptions<MongoDbCdcStateStoreOptions> options)
Parameters
clientIMongoClientThe MongoDB client.
optionsIOptions<MongoDbCdcStateStoreOptions>The CDC state store options.
Methods
ClearStateAsync(string, CancellationToken)
Clears all state for a processor.
public Task ClearStateAsync(string processorId, CancellationToken cancellationToken)
Parameters
processorIdstringThe unique identifier for the processor.
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
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.
GetAllStatesAsync(string, CancellationToken)
Gets detailed state information for all tracked namespaces.
public Task<IReadOnlyList<MongoDbCdcStateEntry>> GetAllStatesAsync(string processorId, CancellationToken cancellationToken)
Parameters
processorIdstringThe unique identifier for the processor.
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task<IReadOnlyList<MongoDbCdcStateEntry>>
A collection of state entries.
GetLastPositionAsync(string, CancellationToken)
Gets the last processed resume token position for a processor.
public Task<MongoDbCdcPosition> GetLastPositionAsync(string processorId, CancellationToken cancellationToken)
Parameters
processorIdstringThe unique identifier for the processor.
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task<MongoDbCdcPosition>
The last processed position, or Start if none exists.
SavePositionAsync(string, MongoDbCdcPosition, CancellationToken)
Saves the current resume token position for a processor.
public Task SavePositionAsync(string processorId, MongoDbCdcPosition position, CancellationToken cancellationToken)
Parameters
processorIdstringThe unique identifier for the processor.
positionMongoDbCdcPositionThe position to save.
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task
A task representing the asynchronous operation.
SaveStateAsync(MongoDbCdcStateEntry, CancellationToken)
Saves detailed state for a specific namespace.
public Task SaveStateAsync(MongoDbCdcStateEntry entry, CancellationToken cancellationToken)
Parameters
entryMongoDbCdcStateEntryThe state entry to save.
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task
A task representing the asynchronous operation.