public virtual void Commit(Commit attempt)
        {
            if (!attempt.IsValid() || attempt.IsEmpty())
            {
                Logger.Debug(Resources.CommitAttemptFailedIntegrityChecks);
                return;
            }

            foreach (var hook in this.pipelineHooks)
            {
                Logger.Debug(Resources.InvokingPreCommitHooks, attempt.CommitId, hook.GetType());
                if (hook.PreCommit(attempt))
                {
                    continue;
                }

                Logger.Info(Resources.CommitRejectedByPipelineHook, hook.GetType(), attempt.CommitId);
                return;
            }

            Logger.Info(Resources.CommittingAttempt, attempt.CommitId, attempt.Events.Count);
            this.persistence.Commit(attempt);

            foreach (var hook in this.pipelineHooks)
            {
                Logger.Debug(Resources.InvokingPostCommitPipelineHooks, attempt.CommitId, hook.GetType());
                hook.PostCommit(attempt);
            }
        }
        public virtual void Commit(Commit attempt)
        {
            if (!attempt.IsValid() || attempt.IsEmpty())
            {
                Logger.Debug(Resources.CommitAttemptFailedIntegrityChecks);
                return;
            }

            foreach (var hook in this.pipelineHooks)
            {
                Logger.Debug(Resources.InvokingPreCommitHooks, attempt.CommitId, hook.GetType());
                if (hook.PreCommit(attempt))
                    continue;

                Logger.Info(Resources.CommitRejectedByPipelineHook, hook.GetType(), attempt.CommitId);
                return;
            }

            Logger.Info(Resources.CommittingAttempt, attempt.CommitId, attempt.Events.Count);
            this.persistence.Commit(attempt);

            foreach (var hook in this.pipelineHooks)
            {
                Logger.Debug(Resources.InvokingPostCommitPipelineHooks, attempt.CommitId, hook.GetType());
                hook.PostCommit(attempt);
            }
        }
예제 #3
0
        void ICommitEvents.Commit(Commit attempt)
        {
            if (!attempt.IsValid() || attempt.IsEmpty())
                return;

            this.ThrowOnDuplicateOrConcurrentWrites(attempt);
            this.PersistAndDispatch(attempt);
        }
예제 #4
0
        void ICommitEvents.Commit(Commit attempt)
        {
            if (!attempt.IsValid() || attempt.IsEmpty())
                return;

            if (this.pipelineHooks.Any(x => !x.PreCommit(attempt)))
                return;

            this.persistence.Commit(attempt);

            foreach (var hook in this.pipelineHooks)
                hook.PostCommit(attempt);
        }
예제 #5
0
        void ICommitEvents.Commit(Commit attempt)
        {
            if (!attempt.IsValid() || attempt.IsEmpty())
            {
                return;
            }

            if (this.pipelineHooks.Any(x => !x.PreCommit(attempt)))
            {
                return;
            }

            this.persistence.Commit(attempt);

            foreach (var hook in this.pipelineHooks)
            {
                hook.PostCommit(attempt);
            }
        }