Class OutboxBulkCleanupAdapter
Default implementation of IOutboxBulkCleanup that delegates to IOutboxStoreAdmin with iterative batch processing.
public sealed class OutboxBulkCleanupAdapter : IOutboxBulkCleanup
- Inheritance
-
OutboxBulkCleanupAdapter
- Implements
- Inherited Members
Remarks
Performs bulk cleanup by repeatedly calling the admin's cleanup method in batches until no more records match the criteria. This avoids long-running database locks.
Constructors
OutboxBulkCleanupAdapter(IOutboxStoreAdmin, ILogger<OutboxBulkCleanupAdapter>)
Default implementation of IOutboxBulkCleanup that delegates to IOutboxStoreAdmin with iterative batch processing.
public OutboxBulkCleanupAdapter(IOutboxStoreAdmin admin, ILogger<OutboxBulkCleanupAdapter> logger)
Parameters
adminIOutboxStoreAdminThe outbox store admin for cleanup operations.
loggerILogger<OutboxBulkCleanupAdapter>The logger for diagnostic output.
Remarks
Performs bulk cleanup by repeatedly calling the admin's cleanup method in batches until no more records match the criteria. This avoids long-running database locks.
Methods
BulkCleanupAllTenantsSentMessagesAsync(DateTimeOffset, int, CancellationToken)
Deletes sent messages in batches, processing up to batchSize per iteration.
public ValueTask<int> BulkCleanupAllTenantsSentMessagesAsync(DateTimeOffset olderThan, int batchSize, CancellationToken cancellationToken)
Parameters
olderThanDateTimeOffsetRemove messages sent before this timestamp.
batchSizeintMaximum number of messages to delete per batch iteration.
cancellationTokenCancellationTokenToken to monitor for cancellation requests.
Returns
Exceptions
- ArgumentOutOfRangeException
Thrown when
batchSizeis less than 1.