public async Task ProcessAsync() { _logger.LogTrace("Starting fallback EventProcessor"); var messages = (await _eventStore.GetUnpublishedAsync(TimeSpan.FromDays(FallbackDays))).ToArray(); if (messages.Length == 0) { return; } _logger.LogInformation("Processing {EventCount} events in fallback EventProcessor", messages.Length); try { foreach (var integrationEvent in messages) { await _eventProcessor.ProcessAsync(integrationEvent.Id); } } catch (Exception e) { _logger.LogError(e, "Error processing events in fallback EventProcessor"); } }
public async Task StartAsync(CancellationToken cancellationToken) { await foreach (var id in _listener.GetMessagesAsync(cancellationToken)) { await _eventProcessor.ProcessAsync(id); } }