Table of Contents

Class MongoDbCdcStateStore

Namespace
Excalibur.Cdc.MongoDB
Assembly
Excalibur.Cdc.MongoDB.dll

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

client IMongoClient

The MongoDB client.

options IOptions<MongoDbCdcStateStoreOptions>

The CDC state store options.

Methods

ClearStateAsync(string, CancellationToken)

Clears all state for a processor.

public Task ClearStateAsync(string processorId, CancellationToken cancellationToken)

Parameters

processorId string

The unique identifier for the processor.

cancellationToken CancellationToken

A 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

processorId string

The unique identifier for the processor.

cancellationToken CancellationToken

A 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

processorId string

The unique identifier for the processor.

cancellationToken CancellationToken

A 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

processorId string

The unique identifier for the processor.

position MongoDbCdcPosition

The position to save.

cancellationToken CancellationToken

A 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

entry MongoDbCdcStateEntry

The state entry to save.

cancellationToken CancellationToken

A token to observe while waiting for the task to complete.

Returns

Task

A task representing the asynchronous operation.