Пример #1
0
 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;
 }
Пример #2
0
        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);
            }
        }
Пример #3
0
 public override void ProcessEvents(IEventBus eventBus, ICheckpointStorage checkpointStorage)
 {
 }
Пример #4
0
 public void ProcessEvents(ICheckpointStorage checkpointStorage)
 {
     DomainEntry.ProcessEvents(checkpointStorage);
 }
Пример #5
0
 public void ProcessEvents(ICheckpointStorage checkpointStorage)
 {
     _eventDispatcher.ProcessEvents(checkpointStorage);
 }
Пример #6
0
 public abstract void ProcessEvents(IEventBus eventBus, ICheckpointStorage checkpointStorage);
Пример #7
0
 public void ProcessEvents(ICheckpointStorage checkpointStorage)
 {
     _domainRepository.ProcessEvents(_eventBus, checkpointStorage);
 }