public EventRecorder( ILogger <EventRecorder> logger, AppSettings appSettings, ICheckpointStorage dateStorage, IMailgunEventRetriever mailgunEventRetriever, IEventStorage eventStorage) { this.logger = logger; this.appSettings = appSettings; this.dateStorage = dateStorage; this.mailgunEventRetriever = mailgunEventRetriever; this.eventStorage = eventStorage; }
public override void ProcessEvents(IEventBus eventBus, ICheckpointStorage checkpointStorage) { if (Interlocked.CompareExchange(ref _isProcessing, 1, 0) == 0) { try { var checkpointToken = checkpointStorage?.GetToken(DispatcherCheckpointTokenName); var commits = _store.Advanced.GetFrom(checkpointToken).ToArray(); Log.Debug("{NrOfCommits} commits found for checkpoint {CheckpointToken}-{CheckpointName}", commits.Length, checkpointToken ?? "null", DispatcherCheckpointTokenName); foreach (var commit in commits) { foreach (var evt in commit.Events) { try { eventBus.Raise(evt.Body as IEvent); } catch (Exception ex) { Log.Error(ex, "Dispatching {@commit} failed", commit); throw; } } checkpointStorage.Save(DispatcherCheckpointTokenName, commit.CheckpointToken); } } catch (Exception ex) { Log.Error(ex, "ProcessEvents failed"); } Interlocked.Exchange(ref _isProcessing, 0); } }
public override void ProcessEvents(IEventBus eventBus, ICheckpointStorage checkpointStorage) { }
public void ProcessEvents(ICheckpointStorage checkpointStorage) { DomainEntry.ProcessEvents(checkpointStorage); }
public void ProcessEvents(ICheckpointStorage checkpointStorage) { _eventDispatcher.ProcessEvents(checkpointStorage); }
public abstract void ProcessEvents(IEventBus eventBus, ICheckpointStorage checkpointStorage);
public void ProcessEvents(ICheckpointStorage checkpointStorage) { _domainRepository.ProcessEvents(_eventBus, checkpointStorage); }