Пример #1
0
        private async Task DispatchInternal <T>(
            string streamid,
            Guid eventId,
            int version,
            DateTimeOffset timeStamp,
            IReadOnlyDictionary <string, object> headers,
            T @event) where T : class
        {
            var projectionEvent = new ProjectionEvent <T>(streamid, eventId, version, timeStamp, headers, @event);

            var handlers = _handlerResolver.ResolveAll <T>();

            foreach (var handler in handlers)
            {
                await handler(projectionEvent, _disposed.Token);
            }
        }
        private static async Task DispatchInternal <T>(
            IProjectionHandlerResolver eventHandlerResolver,
            string streamid,
            Guid eventId,
            int version,
            DateTimeOffset timeStamp,
            IReadOnlyDictionary <string, object> headers,
            T @event,
            CancellationToken cancellationToken) where T : class
        {
            var eventMessage = new ProjectionEvent <T>(streamid, eventId, version, timeStamp, headers, @event);
            var handlers     = eventHandlerResolver.ResolveAll <T>();

            foreach (var handler in handlers)
            {
                await handler(eventMessage, cancellationToken);
            }
        }