protected override void Given() { base.Given(); AllWritesSucceed(); NoOtherStreams(); _commandReader = new ProjectionManagerResponseReader(_bus, _ioDispatcher, 0); _bus.Subscribe<ProjectionManagementMessage.Starting>(_commandReader); }
protected override void Given() { base.Given(); AllWritesSucceed(); NoOtherStreams(); _commandReader = new ProjectionManagerResponseReader(_bus, _ioDispatcher, 0); _bus.Subscribe <ProjectionManagementMessage.Starting>(_commandReader); }
public new void When() { _exception = null; try { _commandReader = new ProjectionManagerResponseReader(_bus, _ioDispatcher); } catch (Exception ex) { _exception = ex; } }
public static void CreateManagerService( StandardComponents standardComponents, ProjectionsStandardComponents projectionsStandardComponents, IDictionary <Guid, IPublisher> queues, TimeSpan projectionQueryExpiry) { IQueuedHandler 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, projectionQueryExpiry); SubscribeMainBus( projectionsStandardComponents.MasterMainBus, projectionManager, projectionsStandardComponents.RunProjections, projectionManagerResponseReader, ioDispatcher, projectionManagerCommandWriter); SubscribeOutputBus(standardComponents, projectionsStandardComponents, forwarder); }
protected override void Given() { base.Given(); AllWritesSucceed(); NoOtherStreams(); _commandReader = new ProjectionCoreServiceCommandReader(_bus, _ioDispatcher, Guid.NewGuid().ToString("N")); _responseReader = new ProjectionManagerResponseReader(_bus, _ioDispatcher, _numberOfWorkers); _bus.Subscribe <ProjectionCoreServiceMessage.StartCore>(_commandReader); _bus.Subscribe <ProjectionCoreServiceMessage.StopCore>(_commandReader); _bus.Subscribe <ProjectionManagementMessage.Starting>(_responseReader); }
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); }
public new void When() { _commandReader = new ProjectionManagerResponseReader(_bus, _ioDispatcher, 0); }
private static void SubscribeMainBus( ISubscriber mainBus, ProjectionManager projectionManager, ProjectionType runProjections, ProjectionManagerResponseReader projectionManagerResponseReader, IODispatcher ioDispatcher, ProjectionManagerCommandWriter projectionManagerCommandWriter) { mainBus.Subscribe<SystemMessage.StateChangeMessage>(projectionManager); mainBus.Subscribe<SystemMessage.SystemCoreReady>(projectionManager); if (runProjections >= ProjectionType.System) { mainBus.Subscribe<ProjectionManagementMessage.Command.Post>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Command.UpdateQuery>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Command.GetQuery>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Command.Delete>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Command.GetStatistics>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Command.GetState>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Command.GetResult>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Command.Disable>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Command.Enable>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Command.Abort>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Command.SetRunAs>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Command.Reset>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Command.StartSlaveProjections>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.RegisterSystemProjection>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Internal.CleanupExpired>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Internal.Deleted>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.RegisterSystemProjection>(projectionManager); mainBus.Subscribe<CoreProjectionStatusMessage.Started>(projectionManager); mainBus.Subscribe<CoreProjectionStatusMessage.Stopped>(projectionManager); mainBus.Subscribe<CoreProjectionStatusMessage.Faulted>(projectionManager); mainBus.Subscribe<CoreProjectionStatusMessage.Prepared>(projectionManager); mainBus.Subscribe<CoreProjectionStatusMessage.StateReport>(projectionManager); mainBus.Subscribe<CoreProjectionStatusMessage.ResultReport>(projectionManager); mainBus.Subscribe<CoreProjectionStatusMessage.StatisticsReport>(projectionManager); mainBus.Subscribe<CoreProjectionManagementMessage.SlaveProjectionReaderAssigned>(projectionManager); mainBus.Subscribe<CoreProjectionStatusMessage.ProjectionWorkerStarted>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.ReaderReady>(projectionManager); mainBus.Subscribe<ProjectionManagementMessage.Starting>(projectionManagerResponseReader); } mainBus.Subscribe<ClientMessage.WriteEventsCompleted>(projectionManager); mainBus.Subscribe<ClientMessage.DeleteStreamCompleted>(projectionManager); mainBus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(projectionManager); mainBus.Subscribe(ioDispatcher.Awaker); mainBus.Subscribe(ioDispatcher.BackwardReader); mainBus.Subscribe(ioDispatcher.ForwardReader); mainBus.Subscribe(ioDispatcher.StreamDeleter); mainBus.Subscribe(ioDispatcher.Writer); mainBus.Subscribe(ioDispatcher); mainBus.Subscribe<ProjectionManagementMessage.Starting>(projectionManagerCommandWriter); mainBus.Subscribe<CoreProjectionManagementMessage.CreatePrepared>(projectionManagerCommandWriter); mainBus.Subscribe<CoreProjectionManagementMessage.CreateAndPrepare>(projectionManagerCommandWriter); mainBus.Subscribe<CoreProjectionManagementMessage.CreateAndPrepareSlave>(projectionManagerCommandWriter); mainBus.Subscribe<CoreProjectionManagementMessage.LoadStopped>(projectionManagerCommandWriter); mainBus.Subscribe<CoreProjectionManagementMessage.Start>(projectionManagerCommandWriter); mainBus.Subscribe<CoreProjectionManagementMessage.Stop>(projectionManagerCommandWriter); mainBus.Subscribe<CoreProjectionManagementMessage.Kill>(projectionManagerCommandWriter); mainBus.Subscribe<CoreProjectionManagementMessage.Dispose>(projectionManagerCommandWriter); mainBus.Subscribe<CoreProjectionManagementMessage.GetState>(projectionManagerCommandWriter); mainBus.Subscribe<CoreProjectionManagementMessage.GetResult>(projectionManagerCommandWriter); mainBus.Subscribe<ProjectionManagementMessage.SlaveProjectionsStarted>(projectionManagerCommandWriter); }
private static void SubscribeMainBus( ISubscriber mainBus, ProjectionManager projectionManager, ProjectionType runProjections, ProjectionManagerResponseReader projectionManagerResponseReader, IODispatcher ioDispatcher, ProjectionManagerCommandWriter projectionManagerCommandWriter) { mainBus.Subscribe <SystemMessage.StateChangeMessage>(projectionManager); mainBus.Subscribe <SystemMessage.SystemReady>(projectionManager); if (runProjections >= ProjectionType.System) { mainBus.Subscribe <ProjectionManagementMessage.Command.Post>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Command.UpdateQuery>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Command.GetQuery>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Command.Delete>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Command.GetStatistics>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Command.GetState>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Command.GetResult>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Command.Disable>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Command.Enable>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Command.Abort>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Command.SetRunAs>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Command.Reset>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Command.StartSlaveProjections>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.RegisterSystemProjection>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Internal.CleanupExpired>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Internal.Deleted>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.RegisterSystemProjection>(projectionManager); mainBus.Subscribe <CoreProjectionStatusMessage.Started>(projectionManager); mainBus.Subscribe <CoreProjectionStatusMessage.Stopped>(projectionManager); mainBus.Subscribe <CoreProjectionStatusMessage.Faulted>(projectionManager); mainBus.Subscribe <CoreProjectionStatusMessage.Prepared>(projectionManager); mainBus.Subscribe <CoreProjectionStatusMessage.StateReport>(projectionManager); mainBus.Subscribe <CoreProjectionStatusMessage.ResultReport>(projectionManager); mainBus.Subscribe <CoreProjectionStatusMessage.StatisticsReport>(projectionManager); mainBus.Subscribe <CoreProjectionManagementMessage.SlaveProjectionReaderAssigned>(projectionManager); mainBus.Subscribe <CoreProjectionStatusMessage.ProjectionWorkerStarted>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.ReaderReady>(projectionManager); mainBus.Subscribe <ProjectionManagementMessage.Starting>(projectionManagerResponseReader); } mainBus.Subscribe <ClientMessage.WriteEventsCompleted>(projectionManager); mainBus.Subscribe <ClientMessage.DeleteStreamCompleted>(projectionManager); mainBus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(projectionManager); mainBus.Subscribe(ioDispatcher.Awaker); mainBus.Subscribe(ioDispatcher.BackwardReader); mainBus.Subscribe(ioDispatcher.ForwardReader); mainBus.Subscribe(ioDispatcher.StreamDeleter); mainBus.Subscribe(ioDispatcher.Writer); mainBus.Subscribe(ioDispatcher); mainBus.Subscribe <ProjectionManagementMessage.Starting>(projectionManagerCommandWriter); mainBus.Subscribe <CoreProjectionManagementMessage.CreatePrepared>(projectionManagerCommandWriter); mainBus.Subscribe <CoreProjectionManagementMessage.CreateAndPrepare>(projectionManagerCommandWriter); mainBus.Subscribe <CoreProjectionManagementMessage.CreateAndPrepareSlave>(projectionManagerCommandWriter); mainBus.Subscribe <CoreProjectionManagementMessage.LoadStopped>(projectionManagerCommandWriter); mainBus.Subscribe <CoreProjectionManagementMessage.Start>(projectionManagerCommandWriter); mainBus.Subscribe <CoreProjectionManagementMessage.Stop>(projectionManagerCommandWriter); mainBus.Subscribe <CoreProjectionManagementMessage.Kill>(projectionManagerCommandWriter); mainBus.Subscribe <CoreProjectionManagementMessage.Dispose>(projectionManagerCommandWriter); mainBus.Subscribe <CoreProjectionManagementMessage.GetState>(projectionManagerCommandWriter); mainBus.Subscribe <CoreProjectionManagementMessage.GetResult>(projectionManagerCommandWriter); mainBus.Subscribe <ProjectionManagementMessage.SlaveProjectionsStarted>(projectionManagerCommandWriter); }
public new void When() { _commandReader = new ProjectionManagerResponseReader(_bus, _ioDispatcher); }