Пример #1
0
        /// <summary>
        /// Dispatch all events within the specified <paramref name="commit"/>.
        /// </summary>
        /// <param name="commit">The commit instance to be dispatched.</param>
        private void DispatchCommit(Commit commit)
        {
            var commitId = commit.Id.GetValueOrDefault();
            var events   = commit.Events;

            for (var i = 0; i < events.Count; i++)
            {
                var e       = events[i];
                var version = new EventVersion(commit.Version, events.Count, i + 1);

                eventPublisher.Publish(commit.Headers, new EventEnvelope(commit.CorrelationId, commit.StreamId, version, e));
            }

            if (markDispatched)
            {
                eventStore.MarkDispatched(commitId);
            }
        }
Пример #2
0
        /// <summary>
        /// Mark the specified commit as being dispatched.
        /// </summary>
        /// <param name="id">The unique commit identifier that has been dispatched.</param>
        public void MarkDispatched(Int64 id)
        {
            eventStore.MarkDispatched(id);

            statistics.IncrementUpdateCount();
        }