diff --git a/src/Paramore.Brighter.Extensions.Hosting/TimedOutboxSweeper.cs b/src/Paramore.Brighter.Extensions.Hosting/TimedOutboxSweeper.cs index 61cd5d6517..bd6731bc71 100644 --- a/src/Paramore.Brighter.Extensions.Hosting/TimedOutboxSweeper.cs +++ b/src/Paramore.Brighter.Extensions.Hosting/TimedOutboxSweeper.cs @@ -41,7 +41,7 @@ private void DoWork(object state) IAmACommandProcessor commandProcessor = scope.ServiceProvider.GetService(); var outBoxSweeper = new OutboxSweeper( - milliSecondsSinceSent: _options.MinimumMessageAge, + millisecondsSinceSent: _options.MinimumMessageAge, commandProcessor: commandProcessor, _options.BatchSize, _options.UseBulk); diff --git a/src/Paramore.Brighter/OutboxSweeper.cs b/src/Paramore.Brighter/OutboxSweeper.cs index 35a3f09c0b..aa69330bc8 100644 --- a/src/Paramore.Brighter/OutboxSweeper.cs +++ b/src/Paramore.Brighter/OutboxSweeper.cs @@ -1,13 +1,8 @@ -using System; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace Paramore.Brighter +namespace Paramore.Brighter { public class OutboxSweeper { - private readonly int _milliSecondsSinceSent; + private readonly int _millisecondsSinceSent; private readonly IAmACommandProcessor _commandProcessor; private readonly int _batchSize; private readonly bool _useBulk; @@ -15,34 +10,33 @@ public class OutboxSweeper /// /// This sweeper clears an outbox of any outstanding messages within the time interval /// - /// How long can a message sit in the box before we attempt to resend + /// How long can a message sit in the box before we attempt to resend /// Who should post the messages /// The maximum number of messages to dispatch. /// Use the producers bulk dispatch functionality. - public OutboxSweeper(int milliSecondsSinceSent, IAmACommandProcessor commandProcessor, int batchSize = 100, + public OutboxSweeper(int millisecondsSinceSent, IAmACommandProcessor commandProcessor, int batchSize = 100, bool useBulk = false) { - _milliSecondsSinceSent = milliSecondsSinceSent; + _millisecondsSinceSent = millisecondsSinceSent; _commandProcessor = commandProcessor; _batchSize = batchSize; _useBulk = useBulk; } + /// + /// Dispatches the oldest un-dispatched messages from the outbox in a background thread. + /// public void Sweep() { - _commandProcessor.ClearOutbox(_batchSize, _milliSecondsSinceSent); - } - - public Task SweepAsync(CancellationToken cancellationToken = default) - { - _commandProcessor.ClearAsyncOutbox(_batchSize, _milliSecondsSinceSent, _useBulk); - - return Task.CompletedTask; + _commandProcessor.ClearOutbox(_batchSize, _millisecondsSinceSent); } + /// + /// Dispatches the oldest un-dispatched messages from the asynchronous outbox in a background thread. + /// public void SweepAsyncOutbox() { - _commandProcessor.ClearAsyncOutbox(_batchSize, _milliSecondsSinceSent, _useBulk); + _commandProcessor.ClearAsyncOutbox(_batchSize, _millisecondsSinceSent, _useBulk); } } }