protected Action <EventStoreCatchUpSubscription, ResolvedEvent> EventAppeared() { return((subscription, @event) => { if (IsSystemEvents(@event)) { return; } if (EventIsFromAnotherContext(@event)) { return; } if (IsSnapshot(@event)) { return; } var deserializedEvent = JsonConvert.DeserializeObject( Encoding.UTF8.GetString(@event.Event.Data), TypeResolver.ResolveDomainEventType(@event.Event.EventType)); using (var container = _serviceLocator.GetInstance <IWindsorContainer>().BeginScope()) { _mediator.SendAsync((dynamic)deserializedEvent, typeof(T)).Wait(); } _checkpointStore.Set(new Checkpoint(typeof(T).Name, @event.OriginalPosition.ToString())).Wait(); }); }