Exemple #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="configService">A collection of library configuration settings.</param>
        /// <param name="eventHandlerService">A collection of domain event handlers.</param>
        /// <param name="projectionHandlerService">A collection of domain model projection handlers.</param>
        public EventStreamManager(EventStreamConfigService configService, DomainEventHandlerService eventHandlerService, ProjectionHandlerService projectionHandlerService)
        {
            if (!configService.ContainsConfiguration <TDomainModelRoot>())
            {
                throw new Exception($"No configuration registered for domain model {typeof(TDomainModelRoot).Name}");
            }

            eventStream = new EventStreamProcessor <TDomainModelRoot>(configService, eventHandlerService, projectionHandlerService);
            logger      = new DebugLogger <EventStreamManager <TDomainModelRoot> >(configService.LoggerFactory);

            logger.LogDebug($"Created {nameof(EventStreamManager<TDomainModelRoot>)} for domain model root {typeof(TDomainModelRoot).Name}");
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="configService">A collection of library configuration settings.</param>
        /// <param name="eventHandlerService">A collection of domain event handlers.</param>
        /// <param name="projectionHandlerService">A collection of domain model projection handlers.</param>
        public EventStreamProcessor(EventStreamConfigService configService, DomainEventHandlerService eventHandlerService, ProjectionHandlerService projectionHandlerService)
        {
            if (!configService.ContainsConfiguration <TDomainModelRoot>())
            {
                throw new Exception($"No configuration registered for domain model {typeof(TDomainModelRoot).Name}");
            }

            this.eventHandlerService      = eventHandlerService;
            this.projectionHandlerService = projectionHandlerService;

            IsInitialized = false;
            config        = configService.GetConfiguration <TDomainModelRoot>();
            logger        = new DebugLogger <EventStreamProcessor <TDomainModelRoot> >(configService.LoggerFactory);

            logger.LogDebug($"Created {nameof(EventStreamProcessor<TDomainModelRoot>)} for domain model root {typeof(TDomainModelRoot).Name}");
        }