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);
}