Example #1
0
 public OutboxCleanerBackgroundService(IServiceScopeFactory scopeFactory,
                                       OutboxCleanerOptions options,
                                       ILogger <OutboxCleanerBackgroundService> logger,
                                       SystemInfo systemInfo)
 {
     _scopeFactory = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory));
     _options      = options ?? throw new ArgumentNullException(nameof(options));
     _logger       = logger ?? throw new ArgumentNullException(nameof(logger));
     _systemInfo   = systemInfo ?? throw new ArgumentNullException(nameof(systemInfo));
 }
Example #2
0
        public IBusConfigurator WithOutboxCleanerOptions(OutboxCleanerOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            this.Services.Replace(ServiceDescriptor.Singleton(options));

            return(this);
        }
Example #3
0
        public async Task StartAsync_should_cleanup_messages()
        {
            var repo    = NSubstitute.Substitute.For <IOutboxRepository>();
            var options = new OutboxCleanerOptions(TimeSpan.FromSeconds(2));
            var sut     = new OutboxCleaner(repo, options);

            var token = new CancellationTokenSource(options.Interval);

            try
            {
                await sut.StartAsync(token.Token);
            }
            catch (TaskCanceledException) { }

            await repo.Received().CleanProcessedAsync(Arg.Any <CancellationToken>());
        }
Example #4
0
 public OutboxCleaner(IOutboxRepository outboxRepository, OutboxCleanerOptions options)
 {
     _outboxRepository = outboxRepository ?? throw new ArgumentNullException(nameof(outboxRepository));
     _options          = options ?? throw new ArgumentNullException(nameof(options));
 }
 public OutboxCleanerBackgroundService(IServiceScopeFactory scopeFactory, OutboxCleanerOptions options)
 {
     _scopeFactory = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory));
     _options      = options ?? throw new ArgumentNullException(nameof(options));
 }