/// <summary>Parameterized constructor.
        /// </summary>
        /// <param name="eventHandlerTypeCodeProvider"></param>
        /// <param name="eventHandlerProvider"></param>
        /// <param name="eventPublishInfoStore"></param>
        /// <param name="eventHandleInfoStore"></param>
        /// <param name="eventHandleInfoCache"></param>
        /// <param name="actionExecutionService"></param>
        /// <param name="loggerFactory"></param>
        public DefaultEventProcessor(
            IEventHandlerTypeCodeProvider eventHandlerTypeCodeProvider,
            IEventHandlerProvider eventHandlerProvider,
            IEventPublishInfoStore eventPublishInfoStore,
            IEventHandleInfoStore eventHandleInfoStore,
            IEventHandleInfoCache eventHandleInfoCache,
            IActionExecutionService actionExecutionService,
            ILoggerFactory loggerFactory)
        {
            _eventHandlerTypeCodeProvider = eventHandlerTypeCodeProvider;
            _eventHandlerProvider = eventHandlerProvider;
            _eventPublishInfoStore = eventPublishInfoStore;
            _eventHandleInfoStore = eventHandleInfoStore;
            _eventHandleInfoCache = eventHandleInfoCache;
            _actionExecutionService = actionExecutionService;
            _logger = loggerFactory.Create(GetType().Name);
            _queueList = new List<BlockingCollection<EventProcessingContext>>();
            for (var index = 0; index < WorkerCount; index++)
            {
                _queueList.Add(new BlockingCollection<EventProcessingContext>(new ConcurrentQueue<EventProcessingContext>()));
            }

            _workerList = new List<Worker>();
            for (var index = 0; index < WorkerCount; index++)
            {
                var queue = _queueList[index];
                var worker = new Worker(() =>
                {
                    DispatchEventsToHandlers(queue.Take());
                });
                _workerList.Add(worker);
                worker.Start();
            }
        }
Exemple #2
0
 public DefaultEventExecutor(
     IEventHandlerProvider eventHandlerProvider,
     IEventPublishInfoStore eventPublishInfoStore,
     IEventHandleInfoStore eventHandleInfoStore,
     IEventPublisher eventPublisher,
     ILoggerFactory loggerFactory)
 {
     _eventHandlerProvider = eventHandlerProvider;
     _eventPublishInfoStore = eventPublishInfoStore;
     _eventHandleInfoStore = eventHandleInfoStore;
     _eventPublisher = eventPublisher;
     _logger = loggerFactory.Create(GetType().Name);
 }