예제 #1
0
        public void ReplayEventsForHandlerType(Type handlerType, DateTime startDate, DateTime endDate)
        {
            runtime.Start();

            var serviceLocator = runtime.ServiceLocator;
            var eventStore = serviceLocator.Resolve<IEventStore>();
            var domainEventTypes = GetDomainEventTypesHandledByHandler(handlerType);

            var domainEvents = eventStore.GetEventsByEventTypes(domainEventTypes, startDate, endDate);
            var eventBus = new LocalEventBus(new[] {handlerType}, new DomainEventHandlerFactory(serviceLocator));

            eventBus.PublishEvents(domainEvents);
        }
        public void ReplayEventsForHandlerType(Type handlerType, Document selector)
        {
            runtime.Start();

            var serviceLocator = runtime.ServiceLocator;
            var eventStore = (MongoEventStore)serviceLocator.Resolve<IEventStore>();
            var domainEventTypes = GetDomainEventTypesHandledByHandler(handlerType);
            selector.Add("_t", new Document{{"$in", domainEventTypes}});
            var domainEvents = eventStore.GetEventsBySelector(selector);
            var eventBus = new LocalEventBus(new []{handlerType}, new DomainEventHandlerFactory(serviceLocator));

            eventBus.PublishEvents(domainEvents);
        }