Interface IDeduplicationStore
Defines a store for message deduplication tracking.
public interface IDeduplicationStore
Methods
AddAsync(string, TimeSpan?, CancellationToken)
Marks a message as processed.
Task AddAsync(string messageId, TimeSpan? expiry, CancellationToken cancellationToken)
Parameters
messageIdstringThe unique identifier of the message.
expiryTimeSpan?Optional expiry time for the deduplication entry.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task representing the asynchronous operation.
CheckAndMarkAsync(string, DeduplicationContext, CancellationToken)
Checks if a message has been processed and marks it as processed if not.
Task<DeduplicationResult> CheckAndMarkAsync(string messageId, DeduplicationContext context, CancellationToken cancellationToken)
Parameters
messageIdstringThe unique identifier of the message.
contextDeduplicationContextThe deduplication context.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<DeduplicationResult>
A result indicating whether the message is a duplicate.
ClearExpiredAsync(CancellationToken)
Clears expired entries from the store.
Task<int> ClearExpiredAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation token.
Returns
ContainsAsync(string, CancellationToken)
Checks if a message has been processed.
Task<bool> ContainsAsync(string messageId, CancellationToken cancellationToken)
Parameters
messageIdstringThe unique identifier of the message.
cancellationTokenCancellationTokenThe cancellation token.
Returns
RemoveAsync(string, CancellationToken)
Removes a message from the deduplication store.
Task<bool> RemoveAsync(string messageId, CancellationToken cancellationToken)
Parameters
messageIdstringThe unique identifier of the message.
cancellationTokenCancellationTokenThe cancellation token.