예제 #1
0
        public Task OnEventAsync(Immutable <IEventSubscription> subscription, Immutable <StoredEvent> storedEvent)
        {
            if (subscription.Value != currentSubscription)
            {
                return(TaskHelper.Done);
            }

            return(DoAndUpdateStateAsync(async() =>
            {
                var @event = ParseKnownEvent(storedEvent.Value);

                if (@event != null)
                {
                    await DispatchConsumerAsync(@event);
                }

                state = state.Handled(storedEvent.Value.EventPosition);
            }));
        }
예제 #2
0
        private Task HandleEventAsync(IEventSubscription subscription, StoredEvent storedEvent)
        {
            if (subscription != currentSubscription)
            {
                return(TaskHelper.Done);
            }

            return(DoAndUpdateStateAsync(async() =>
            {
                var @event = ParseKnownEvent(storedEvent);

                if (@event != null)
                {
                    await DispatchConsumerAsync(@event);
                }

                state = state.Handled(storedEvent.EventPosition);
            }));
        }