EventStore.Projections.Core.ProjectionManagerNode.CreateManagerService C# (CSharp) Method

CreateManagerService() public static method

public static CreateManagerService ( StandardComponents standardComponents, EventStore.Projections.Core.ProjectionsStandardComponents projectionsStandardComponents, IPublisher>.IDictionary queues ) : void
standardComponents StandardComponents
projectionsStandardComponents EventStore.Projections.Core.ProjectionsStandardComponents
queues IPublisher>.IDictionary
return void
        public static void CreateManagerService(
            StandardComponents standardComponents,
            ProjectionsStandardComponents projectionsStandardComponents,
            IDictionary<Guid, IPublisher> queues)
        {
            QueuedHandler inputQueue = projectionsStandardComponents.MasterInputQueue;
            InMemoryBus outputBus = projectionsStandardComponents.MasterOutputBus;
            var ioDispatcher = new IODispatcher(outputBus, new PublishEnvelope(inputQueue));

            var projectionsController = new ProjectionsController(
                standardComponents.HttpForwarder,
                inputQueue,
                standardComponents.NetworkSendService);

            var forwarder = new RequestResponseQueueForwarder(
                inputQueue: projectionsStandardComponents.MasterInputQueue,
                externalRequestQueue: standardComponents.MainQueue);

            if (projectionsStandardComponents.RunProjections != ProjectionType.None)
            {
                foreach (var httpService in standardComponents.HttpServices)
                {
                    httpService.SetupController(projectionsController);
                }
            }

            var commandWriter = new MultiStreamMessageWriter(ioDispatcher);
            var projectionManagerCommandWriter = new ProjectionManagerCommandWriter(commandWriter);
            var projectionManagerResponseReader = new ProjectionManagerResponseReader(outputBus, ioDispatcher, queues.Count);

            var projectionManager = new ProjectionManager(
                inputQueue,
                outputBus,
                queues,
                new RealTimeProvider(),
                projectionsStandardComponents.RunProjections,
                ioDispatcher);

            SubscribeMainBus(
                projectionsStandardComponents.MasterMainBus,
                projectionManager,
                projectionsStandardComponents.RunProjections,
                projectionManagerResponseReader,
                ioDispatcher,
                projectionManagerCommandWriter);


            SubscribeOutputBus(standardComponents, projectionsStandardComponents, forwarder);
        }

Usage Example

        public void Register(StandardComponents standardComponents)
        {
            _leaderInputQueue = QueuedHandler.CreateQueuedHandler(_leaderMainBus, "Projections Leader",
                                                                  standardComponents.QueueStatsManager);
            _leaderOutputBus = new InMemoryBus("ProjectionManagerAndCoreCoordinatorOutput");

            _leaderMainBus.Subscribe <ProjectionSubsystemMessage.RestartSubsystem>(this);
            _leaderMainBus.Subscribe <ProjectionSubsystemMessage.ComponentStarted>(this);
            _leaderMainBus.Subscribe <ProjectionSubsystemMessage.ComponentStopped>(this);
            _leaderMainBus.Subscribe <ProjectionSubsystemMessage.IODispatcherDrained>(this);
            _leaderMainBus.Subscribe <SystemMessage.SystemCoreReady>(this);
            _leaderMainBus.Subscribe <SystemMessage.StateChangeMessage>(this);

            var projectionsStandardComponents = new ProjectionsStandardComponents(
                _projectionWorkerThreadCount,
                _runProjections,
                _leaderOutputBus,
                _leaderInputQueue,
                _leaderMainBus, _faultOutOfOrderProjections);

            CreateAwakerService(standardComponents);
            _coreQueues =
                ProjectionCoreWorkersNode.CreateCoreWorkers(standardComponents, projectionsStandardComponents);
            _queueMap = _coreQueues.ToDictionary(v => v.Key, v => (IPublisher)v.Value);

            ProjectionManagerNode.CreateManagerService(standardComponents, projectionsStandardComponents, _queueMap,
                                                       _projectionsQueryExpiry);
            projectionsStandardComponents.LeaderMainBus.Subscribe <CoreProjectionStatusMessage.Stopped>(this);
            projectionsStandardComponents.LeaderMainBus.Subscribe <CoreProjectionStatusMessage.Started>(this);
        }
All Usage Examples Of EventStore.Projections.Core.ProjectionManagerNode::CreateManagerService