示例#1
0
        protected void Application_Start()
        {
            var cs = ConnectionSettings.Create();

            var endpoint = new IPEndPoint(IPAddress.Loopback, 1113);
            var con      = EventStoreConnection.Create(endpoint);

            con.ConnectAsync();

            var credentials = new EventStore.ClientAPI.SystemData.UserCredentials("admin", "changeit");

            var adapter = new EventStoreAdapter(endpoint, credentials);

            ProjectionManager = new ProjectionManager(endpoint, credentials, adapter);
            ProjectionManager.Run();

            CommandManager = new CommandManager(con);

            //var binder = new DefaultModelBinder();
            //ModelBinders.Binders.Add(typeof(DateTime), binder);
            //ModelBinders.Binders.Add(typeof(DateTime?), binder);

            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
        public void setup()
        {
            _publisher = new FakePublisher();
            _manager = new ProjectionManager(_publisher, checkpointForStatistics: null);

            _manager.Handle(new ProjectionManagementMessage.Post(new PublishEnvelope(_publisher), @"log(1);", enabled: true));
        }
示例#3
0
        public async Task StartProjectingAsync(int currentViewId, int newViewId)
        {
            if (ProjectionManager.ProjectionDisplayAvailable)
            {
                if (_selectedDeviceInformation == null)
                {
                    _selectedDeviceInformation = await DeviceInformation.CreateFromIdAsync(SelectedDeviceID);
                }


                if (_selectedDeviceInformation != null)
                {
                    bool isFound = false;
                    do
                    {
                        try
                        {
                            await ProjectionManager.StartProjectingAsync(newViewId, currentViewId, _selectedDeviceInformation);

                            isFound = true;
                        }
                        catch (ArgumentException)
                        {
                            // just ignore the exception, the projection is anyway going on
                            isFound = true;
                        }
                        catch (Exception)
                        {
                            // TODO: Unexpected exception handling
                        }
                    } while (!isFound);
                }
            }
        }
        private async void PhotosGrid_ItemClick(object sender, ItemClickEventArgs e)
        {
            FileInformation photo = (FileInformation)e.ClickedItem;

            if (projectionWindow == null)
            {
                CoreApplicationView newView = CoreApplication.CreateNewView();
                int projectionView          = 0;
                await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    Frame frame = new Frame();
                    frame.Navigate(typeof(ProjectedPhoto), photo, new SuppressNavigationTransitionInfo());
                    Window.Current.Content = frame;
                    Window.Current.Activate();
                    projectionWindow = Window.Current;
                    projectionView   = ApplicationView.GetForCurrentView().Id;
                });

                await ProjectionManager.StartProjectingAsync(projectionView, ApplicationView.GetForCurrentView().Id);
            }
            else
            {
                await projectionWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    (projectionWindow.Content as Frame).Navigate(typeof(ProjectedPhoto), photo, new SuppressNavigationTransitionInfo());
                });
            }
        }
        private async Task ConfigureServicesAsync(IServiceCollection services)
        {
            var esConnection = await Defaults.GetConnection();

            var typeMapper = ConfigureTypeMapper();

            services.AddMvc();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "Event Log API", Version = "v1"
                });
                c.IncludeXmlComments($"{AppDomain.CurrentDomain.BaseDirectory}/Marketplace.xml");
            });
            services.AddSingleton <IAggregateStore>(new GesAggregateStore(
                                                        (type, id) => $"{type.Name}-{id}",
                                                        esConnection,
                                                        new JsonNetSerializer(),
                                                        typeMapper
                                                        ));

            var openSession = ConfgiureRavenDb();

            var projectionManager = new ProjectionManager(
                esConnection,
                new RavenCheckpointStore(openSession),
                new JsonNetSerializer(),
                typeMapper,
                new [] { new ActiveClassifiedAds(openSession), });
            await projectionManager.Activate();
        }
        public void setup()
        {
            //TODO: this became a n integration test - proper ProjectionCoreService and ProjectionManager testing is required instead
            _bus.Subscribe(_consumer);

            _manager = new ProjectionManager(_bus, _bus, new IPublisher[] {_bus});
            _coreService = new ProjectionCoreService(_bus, _bus, 10, new InMemoryCheckpoint(1000));
            _bus.Subscribe<CoreProjectionManagementMessage.Started>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Stopped>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Prepared>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Faulted>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.StateReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.StatisticsReport>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);

            _bus.Subscribe<CoreProjectionManagementMessage.CreateAndPrepare>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.Dispose>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.Start>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.Stop>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.Kill>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.GetState>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.UpdateStatistics>(_coreService);
            _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_coreService);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_coreService);

            When();
        }
示例#7
0
 protected override void Given()
 {
     _projectionName = "test-projection";
     _manager        = new ProjectionManager(_bus, _bus, new IPublisher[] { _bus }, checkpointForStatistics: null);
     _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
     AllWritesQueueUp();
 }
示例#8
0
        public async Task <int> ProjectAsync(Type viewType, DeviceInformation device = null)
        {
            int mainViewId   = ApplicationView.GetForCurrentView().Id;
            int?secondViewId = null;

            var view = CoreApplication.CreateNewView();
            await view.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                secondViewId  = ApplicationView.GetForCurrentView().Id;
                var rootFrame = new Frame();
                rootFrame.Navigate(viewType, null);
                Window.Current.Content = rootFrame;
                Window.Current.Activate();
            });

            if (secondViewId.HasValue)
            {
                if (device == null)
                {
                    await ProjectionManager.StartProjectingAsync(secondViewId.Value, mainViewId);
                }
                else
                {
                    await ProjectionManager.StartProjectingAsync(secondViewId.Value, mainViewId, device);
                }
            }

            return(mainViewId);
        }
 public void setup()
 {
     _manager = new ProjectionManager(_bus, _bus, new IPublisher[] { _bus });
     _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.BecomeWorking());
 }
 public void setup()
 {
     _manager = new ProjectionManager(_bus, _bus, new IPublisher[]{_bus});
     _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.BecomeWorking());
 }
 private ProjectionManagerNode(IPublisher inputQueue, IPublisher[] queues, RunProjections runProjections)
 {
     _runProjections = runProjections;
     _output = new InMemoryBus("ProjectionManagerOutput");
     _projectionManager = new ProjectionManager(
         inputQueue, _output, queues, new RealTimeProvider(), runProjections);
 }
        public async Task Then_the_projection_processed_the_next_events_as_subscription()
        {
            ProjectionManager.Start(_projection);

            _waitForProjection.WaitOne();
            _waitForProjection.Reset();
            _waitForProjection.WaitOne();
            await Task.Delay(1000);

            ProjectionManager
            .GetRegisteredProjections()
            .Should()
            .Contain(connectedProjection =>
                     connectedProjection.Name.Equals(_projection) &&
                     connectedProjection.State == ConnectedProjectionState.Subscribed);

            await PushToStream(Fixture.CreateMany <SomethingHappened>(4));

            await Task.Delay(500);

            var assertionContext = new ProjectionContext(CreateContextOptionsFor <ProjectionContext>());

            assertionContext.ProcessedEvents
            .Should()
            .ContainAll(
                PushedMessages,
                (processedMessage, message, i) => processedMessage.Position == i && processedMessage.Event == message.GetType().Name&& processedMessage.EvenTime == message.On);
        }
示例#13
0
        public void setup()
        {
            //TODO: this became a n integration test - proper ProjectionCoreService and ProjectionManager testing is required instead
            _bus.Subscribe(_consumer);

            _manager     = new ProjectionManager(_bus, _bus, new IPublisher[] { _bus }, checkpointForStatistics: null);
            _coreService = new ProjectionCoreService(_bus, _bus, 10, new InMemoryCheckpoint(1000));
            _bus.Subscribe <ProjectionMessage.Projections.StatusReport.Stopped>(_manager);
            _bus.Subscribe <ProjectionMessage.Projections.Management.StateReport>(_manager);
            _bus.Subscribe <ProjectionMessage.Projections.Management.StatisticsReport>(_manager);
            _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
            _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);

            _bus.Subscribe <ProjectionMessage.CoreService.Management.Create>(_coreService);
            _bus.Subscribe <ProjectionMessage.CoreService.Management.Dispose>(_coreService);
            _bus.Subscribe <ProjectionMessage.Projections.Management.Start>(_coreService);
            _bus.Subscribe <ProjectionMessage.Projections.Management.Stop>(_coreService);
            _bus.Subscribe <ProjectionMessage.Projections.Management.GetState>(_coreService);
            _bus.Subscribe <ProjectionMessage.Projections.Management.UpdateStatistics>(_coreService);
            _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(_coreService);
            _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_coreService);


            When();
        }
示例#14
0
        public static void UseEventStore(this ProjectionGatewayConfiguration projectionGatewayConfiguration, ConnectionSettings connection, ClusterSettings clusterSettings, IPEndPoint tcpEndpoint)
        {
            var eventStoreConnection = EventStoreConnection.Create(connection, clusterSettings);

            ProjectionManager.Configure(projectionGatewayConfiguration, tcpEndpoint, connection.DefaultUserCredentials);
            Start(projectionGatewayConfiguration, eventStoreConnection);
        }
示例#15
0
        public virtual ActionResult ByCategory(string budgetId, string From, string To)
        {
            DateTime?from = null;
            DateTime?to   = null;

            if (From != null)
            {
                from = DateTime.Parse(From);
            }
            if (To != null)
            {
                to = DateTime.Parse(To);
            }

            var projection = ProjectionManager.GetBudgetLinesProjection(budgetId);
            IEnumerable <BudgetLine> lines = projection.GetAllLinesBetween(from, to);

            if (from == null)
            {
                from = lines.Select(s => s.Date).DefaultIfEmpty(DateTime.MinValue).Min(r => r.Date.Date);
            }
            if (to == null)
            {
                to = lines.Select(s => s.Date).DefaultIfEmpty(DateTime.MaxValue).Max(r => r.Date.Date);
            }

            var categories = ProjectionManager.GetCategories().GetBudgetsCategories(budgetId);
            var model      = new BudgetStatsByCategoryViewModel(categories, lines, budgetId, "NA", from, to);

            return(View(model));
        }
示例#16
0
    public bool Move(Cell targetCell, bool animate, int distance)
    {
        if (animate)
        {
            List <Cell> path = PathFinding.FindPath(MapInfos, CurrentCell, targetCell);
            if (path != null)
            {
                Movement.StartMovement(path, CurrentCell);
                ProjectionManager.SelectPath(path);
            }
        }
        else
        {
            transform.position = targetCell.GetVector3Position();
        }

        if (CurrentCell != null)
        {
            CurrentCell.IsTaken = null;
        }
        CurrentCell         = targetCell;
        CurrentCell.IsTaken = this;

        if (distance > 0)
        {
            AttributesSheet.AddCostAttribute(new Attribute(AttributeType.MovementPoint, -distance, PropertyType.Value, 1));
            CombatUIManager.UpdateMovementPoint(AttributesSheet.GetAttribute(AttributeType.MovementPoint));
        }
        return(true);
    }
示例#17
0
    public void GetTargetsInAreaOfEffect(ProjectionManager pm, Unit caster)
    {
        Targets = new List <Unit>();
        foreach (Cell cell in pm.AreaOfEffect)
        {
            pm.ColorCell(cell.X, cell.Z, Color.magenta);
            if (cell.IsTaken)
            {
                if (!HitSelf && cell.IsTaken == caster)
                {
                    continue;
                }

                if (!HitAllies && cell.IsTaken.Team == caster.Team)
                {
                    continue;
                }

                if (!HitEnemies && cell.IsTaken.Team != caster.Team)
                {
                    continue;
                }

                Targets.Add(cell.IsTaken);
            }
        }
        pm.EnableProjections(pm.Selection, true);
    }
 public void setup()
 {
     _manager = new ProjectionManager(_bus, _bus, new IPublisher[]{_bus}, checkpointForStatistics: null);
     _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.SystemStart());
 }
示例#19
0
        private async void LoadAndDisplayScreens_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Use the device selector query of the ProjectionManager to list wired/wireless displays
                String projectorSelectorQuery = ProjectionManager.GetDeviceSelector();

                this.findAndProject_button.IsEnabled = false;

                // Clear the list box
                this.displayList_listview.Items.Clear();
                this.displayList_listview.Visibility = Visibility.Visible;

                rootPage.NotifyUser("Searching for devices...", NotifyType.StatusMessage);

                // Calling the device API to find devices based on the device query
                var outputDevices = await DeviceInformation.FindAllAsync(projectorSelectorQuery);

                // List found devices in the UI
                for (int i = 0; i < outputDevices.Count; i++)
                {
                    var device = outputDevices[i];
                    this.displayList_listview.Items.Add(device);
                }

                this.findAndProject_button.IsEnabled = true;
                rootPage.NotifyUser("Found devices are now listed.", NotifyType.StatusMessage);
            }
            catch (InvalidOperationException)
            {
                rootPage.NotifyUser("An error occured when querying and listing devices.", NotifyType.ErrorMessage);
            }
        }
        private void View_NewProject(object sender, EventArgs e)
        {
            if (IsProjectLoaded())
            {
                MessageBox.Show("Bitte schließen Sie zunächst das geöffnete Projekt.");
                return;
            }

            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter = "FieldTool-Projekt|*.ftproj";

            DialogResult dr = dialog.ShowDialog();

            if (dr != DialogResult.OK)
            {
                return;
            }

            Project = new FtProject(dialog.FileName);
            Project.Save();
            ProjectionManager.SetSourceProjection(Project.EPSGSourceProjection);
            ProjectionManager.SetTargetProjection(Project.EPSGTargetProjection);
            InvokeProjectStateChanged(new ProjectStateArgs(Project.ProjectFilePath, Project.ProjectName, true));
        }
 protected override void Given()
 {
     _projectionName = "test-projection";
     _manager = new ProjectionManager(_bus, checkpointForStatistics: null);
     _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
     AllWritesQueueUp();
 }
 public void setup()
 {
     _timeProvider = new FakeTimeProvider();
     _manager      = new ProjectionManager(_bus, _bus, new IPublisher[] { _bus }, _timeProvider, RunProjections.All);
     _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.BecomeMaster(Guid.NewGuid()));
 }
示例#23
0
 public void match_body_to_projection(ProjectionManager aManager)
 {
     foreach (KeyValuePair <ZgJointId, ProjectionManager.Stupid> e in aManager.mImportant)
     {
         mParts[e.Key].transform.rotation = Quaternion.AngleAxis(e.Value.smoothing.current, Vector3.forward);
     }
     mParts[ZgJointId.Waist].transform.rotation = Quaternion.AngleAxis(aManager.mWaist.current, Vector3.forward);
 }
 public void setup()
 {
     _timeProvider = new FakeTimeProvider();
     _manager = new ProjectionManager(_bus, _bus, new IPublisher[] { _bus }, _timeProvider, RunProjections.All);
     _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.BecomeMaster(Guid.NewGuid()));
 }
示例#25
0
        public virtual ActionResult Index(string id)
        {
            var readModel = ProjectionManager.GetBudgetLinesProjection(id);
            var lines     = readModel.GetAllLines();
            var model     = new BudgetLinesViewModel(id, lines);

            return(View(model));
        }
示例#26
0
        public void Setup()
        {
            //TODO: this became an integration test - proper ProjectionCoreService and ProjectionManager testing is required as well
            _bus.Subscribe(_consumer);

            _manager = new ProjectionManager(
                GetInputQueue(), GetInputQueue(), GivenCoreQueues(), _timeProvider, RunProjections.All,
                _initializeSystemProjections);

            IPublisher inputQueue   = GetInputQueue();
            IPublisher publisher    = GetInputQueue();
            var        ioDispatcher = new IODispatcher(publisher, new PublishEnvelope(inputQueue));

            _bus.Subscribe <ProjectionManagementMessage.Internal.CleanupExpired>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.Internal.Deleted>(_manager);
            _bus.Subscribe <CoreProjectionManagementMessage.Started>(_manager);
            _bus.Subscribe <CoreProjectionManagementMessage.Stopped>(_manager);
            _bus.Subscribe <CoreProjectionManagementMessage.Prepared>(_manager);
            _bus.Subscribe <CoreProjectionManagementMessage.Faulted>(_manager);
            _bus.Subscribe <CoreProjectionManagementMessage.StateReport>(_manager);
            _bus.Subscribe <CoreProjectionManagementMessage.ResultReport>(_manager);
            _bus.Subscribe <CoreProjectionManagementMessage.StatisticsReport>(_manager);
            _bus.Subscribe <CoreProjectionManagementMessage.SlaveProjectionReaderAssigned>(_manager);

            _bus.Subscribe <ProjectionManagementMessage.Post>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.UpdateQuery>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.GetQuery>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.Delete>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.GetStatistics>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.GetState>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.GetResult>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.Disable>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.Enable>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.Abort>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.SetRunAs>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.Reset>(_manager);
            _bus.Subscribe <ProjectionManagementMessage.StartSlaveProjections>(_manager);
            _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
            _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe <SystemMessage.StateChangeMessage>(_manager);

            _bus.Subscribe <ClientMessage.ReadStreamEventsForwardCompleted>(ioDispatcher.ForwardReader);
            _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(ioDispatcher.BackwardReader);
            _bus.Subscribe <ClientMessage.WriteEventsCompleted>(ioDispatcher.Writer);
            _bus.Subscribe <ClientMessage.DeleteStreamCompleted>(ioDispatcher.StreamDeleter);
            _bus.Subscribe <IODispatcherDelayedMessage>(ioDispatcher);

            _awakeReaderService = new AwakeReaderService();
            _bus.Subscribe <StorageMessage.EventCommitted>(_awakeReaderService);
            _bus.Subscribe <StorageMessage.TfEofAtNonCommitRecord>(_awakeReaderService);
            _bus.Subscribe <AwakeReaderServiceMessage.SubscribeAwake>(_awakeReaderService);
            _bus.Subscribe <AwakeReaderServiceMessage.UnsubscribeAwake>(_awakeReaderService);


            Given();
            WhenLoop();
        }
示例#27
0
        private async void DevicePicker_DeviceSelected(DevicePicker sender, DeviceSelectedEventArgs args)
        {
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
            {
                // 更新 picker 上設備的 status
                sender.SetDisplayStatus(args.SelectedDevice, "connecting", DevicePickerDisplayStatusOptions.ShowProgress);

                // 取得目前選到設備的資訊
                activeDevice = args.SelectedDevice;

                // 現在 view 的 Id 與 CoreDispatcher
                int currentViewId = ApplicationView.GetForCurrentView().Id;
                CoreDispatcher currentDispatcher = Window.Current.Dispatcher;

                // 建立新的 view,
                if (projectionInstance.ProjectionViewPageControl == null)
                {
                    await CoreApplication.CreateNewView().Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        // 建立新 viewe 的生命管理器
                        projectionInstance.ProjectionViewPageControl = ViewLifetimeControl.CreateForCurrentView();
                        projectionInstance.MainViewId = currentViewId;

                        var rootFrame = new Frame();
                        rootFrame.Navigate(typeof(ProjectionPage), projectionInstance);

                        // 這裏的 Window 代表是新建立這個 view 的 Window
                        // 但是要等到呼叫 ProjectionManager.StartProjectingAsync 才會顯示
                        Window.Current.Content = rootFrame;
                        Window.Current.Activate();
                    });
                }

                // 直接切換到指定的 view id
                //bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(projectionInstance.ProjectionViewPageControl.Id);

                // 通知要使用新的 view
                projectionInstance.ProjectionViewPageControl.StartViewInUse();

                try
                {
                    txtViewId.Text = $"{projectionInstance.ProjectionViewPageControl.Id}, {currentViewId}";
                    await ProjectionManager.StartProjectingAsync(projectionInstance.ProjectionViewPageControl.Id, currentViewId, activeDevice);

                    player.Pause();

                    sender.SetDisplayStatus(args.SelectedDevice, "connected", DevicePickerDisplayStatusOptions.ShowDisconnectButton);
                }
                catch (Exception ex)
                {
                    sender.SetDisplayStatus(args.SelectedDevice, ex.Message, DevicePickerDisplayStatusOptions.ShowRetryButton);
                    if (ProjectionManager.ProjectionDisplayAvailable == false)
                    {
                        throw;
                    }
                }
            });
        }
 public TournamentSubscriber(
     PostgresOptions postgresOptions,
     ITeamQueryHandler teamQueryHandler)
     : base(
         new StreamConfig(Constants.InMemoryStream, Constants.TournamentNamespace))
 {
     _projectionManager = new ProjectionManager <TournamentProjection>("read", "tournament_projection", postgresOptions);
     _teamQueryHandler  = teamQueryHandler;
 }
        public void setup()
        {
            _publisher = new FakePublisher();
            _manager = new ProjectionManager(_publisher, checkpointForStatistics: null);

            _projectionQuery = @"fromAll(); on_any(function(){});log(1);";
            _manager.Handle(new ProjectionManagementMessage.Post(new PublishEnvelope(_publisher), _projectionQuery, enabled: true));
            _projectionName = _publisher.Messages.OfType<ProjectionManagementMessage.Updated>().Single().Name;
        }
示例#30
0
        public virtual ActionResult Edit(string budgetId, string lineId)
        {
            var categories = ProjectionManager.GetCategories().GetBudgetsCategories(new Domain.Budgets.BudgetId(budgetId));
            var budget     = ProjectionManager.GetBudgetsList().GetBudgetById(new Domain.Budgets.BudgetId(budgetId));

            var model = new EditBudgetLineViewModel(budget.Name, budget.Id, budget.CurrencyISOCode, ProjectionManager.GetStreamEvents(lineId), categories, budget.GetDistributionKeys(), Currencies.GetAll());

            return(View(model));
        }
        public void Setup()
        {
            //TODO: this became an integration test - proper ProjectionCoreService and ProjectionManager testing is required as well
            _bus.Subscribe(_consumer);

            _manager = new ProjectionManager(
                GetInputQueue(), GetInputQueue(), GivenCoreQueues(), _timeProvider, RunProjections.All,
                _initializeSystemProjections);

            IPublisher inputQueue = GetInputQueue();
            IPublisher publisher = GetInputQueue();
            var ioDispatcher = new IODispatcher(publisher, new PublishEnvelope(inputQueue));
            _bus.Subscribe<ProjectionManagementMessage.Internal.CleanupExpired>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Internal.Deleted>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Started>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Stopped>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Prepared>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Faulted>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.StateReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.ResultReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.StatisticsReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.SlaveProjectionReaderAssigned>(_manager);
            
            _bus.Subscribe<ProjectionManagementMessage.Post>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.UpdateQuery>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetQuery>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Delete>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetStatistics>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetState>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetResult>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Disable>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Enable>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Abort>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.SetRunAs>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Reset>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.StartSlaveProjections>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe<SystemMessage.StateChangeMessage>(_manager);

            _bus.Subscribe<ClientMessage.ReadStreamEventsForwardCompleted>(ioDispatcher.ForwardReader);
            _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(ioDispatcher.BackwardReader);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(ioDispatcher.Writer);
            _bus.Subscribe<ClientMessage.DeleteStreamCompleted>(ioDispatcher.StreamDeleter);
            _bus.Subscribe<IODispatcherDelayedMessage>(ioDispatcher);

            _awakeReaderService = new AwakeReaderService();
            _bus.Subscribe<StorageMessage.EventCommitted>(_awakeReaderService);
            _bus.Subscribe<StorageMessage.TfEofAtNonCommitRecord>(_awakeReaderService);
            _bus.Subscribe<AwakeReaderServiceMessage.SubscribeAwake>(_awakeReaderService);
            _bus.Subscribe<AwakeReaderServiceMessage.UnsubscribeAwake>(_awakeReaderService);


            Given();
            WhenLoop();
        }
 public void setup()
 {
     _manager = new ProjectionManager(_bus, checkpointForStatistics: null);
     _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
     _projectionName = "test-projection";
     _manager.Handle(
         new ProjectionManagementMessage.Post(
             new PublishEnvelope(_bus), ProjectionMode.Persistent, _projectionName, "JS",
             @"fromAll(); on_any(function(){});log(1);", enabled: true));
 }
        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 void setup()
 {
     _timeProvider = new FakeTimeProvider();
     var queues = new Dictionary<Guid, IPublisher> { { _workerId, _bus } };
     _manager = new ProjectionManager(
         _bus,
         _bus,
         queues,
         _timeProvider,
         ProjectionType.All);
     _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.BecomeMaster(Guid.NewGuid()));
     _manager.Handle(new ProjectionManagementMessage.ReaderReady());
 }
        public void setup()
        {
            //TODO: this became a n integration test - proper ProjectionCoreService and ProjectionManager testing is required instead
            _bus.Subscribe(_consumer);

            _manager = new ProjectionManager(_bus, _bus, new IPublisher[] {_bus});
            _coreService = new ProjectionCoreService(_bus, _bus, 10, new InMemoryCheckpoint(1000));
            _bus.Subscribe<CoreProjectionManagementMessage.Started>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Stopped>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Prepared>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Faulted>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.StateReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.StatisticsReport>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe<SystemMessage.StateChangeMessage>(_manager);

            _bus.Subscribe<CoreProjectionManagementMessage.CreateAndPrepare>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.CreatePrepared>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.Dispose>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.Start>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.LoadStopped>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.Stop>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.Kill>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.GetState>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.GetDebugState>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.UpdateStatistics>(_coreService);
            _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_coreService);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_coreService);
            _bus.Subscribe<ProjectionCoreServiceMessage.Start>(_coreService);
            _bus.Subscribe<ProjectionCoreServiceMessage.Stop>(_coreService);
            _bus.Subscribe<ProjectionCoreServiceMessage.Tick>(_coreService);
            _bus.Subscribe<ProjectionCoreServiceMessage.CommittedEventDistributed>(_coreService);
            _bus.Subscribe<ProjectionCoreServiceMessage.EventReaderEof>(_coreService);
            _bus.Subscribe<ProjectionCoreServiceMessage.EventReaderIdle>(_coreService);
            _bus.Subscribe<ProjectionSubscriptionManagement.Pause>(_coreService);
            _bus.Subscribe<ProjectionSubscriptionManagement.Resume>(_coreService);
            _bus.Subscribe<ProjectionSubscriptionManagement.Subscribe>(_coreService);
            _bus.Subscribe<ProjectionSubscriptionManagement.Unsubscribe>(_coreService);
            

            Given();
            When();
        }
        public void Setup()
        {
            //TODO: this became an integration test - proper ProjectionCoreService and ProjectionManager testing is required as well
            _bus.Subscribe(_consumer);

            _processingQueues = GivenProcessingQueues();
            _manager = new ProjectionManager(
                GetInputQueue(), GetInputQueue(), _processingQueues.Select(v => v.Item1).ToArray(), _timeProvider, RunProjections.All,
                _initializeSystemProjections);

            _bus.Subscribe<ProjectionManagementMessage.Internal.CleanupExpired>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Internal.Deleted>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Started>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Stopped>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Prepared>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Faulted>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.StateReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.ResultReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.StatisticsReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.SlaveProjectionReaderAssigned>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Post>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.UpdateQuery>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetQuery>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Delete>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetStatistics>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetState>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetResult>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Disable>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Enable>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Abort>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.SetRunAs>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Reset>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.StartSlaveProjections>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe<SystemMessage.StateChangeMessage>(_manager);


            foreach(var q in _processingQueues)
                SetUpCoreServices(q.Item1, q.Item2, q.Item3);

            //Given();
            WhenLoop();
        }
        public void setup()
        {
            _bus = new InMemoryBus("bus");
            _consumer = new WatchingConsumer();
            _bus.Subscribe(_consumer);

            _manager = new ProjectionManager(_bus, checkpointForStatistics: null);
            _bus.Subscribe<ProjectionMessage.Projections.Stopped>(_manager);
            _projectionName = "test-projection";
            _manager.Handle(
                new ProjectionManagementMessage.Post(
                    new PublishEnvelope(_bus), ProjectionMode.AdHoc, _projectionName, "JS",
                    @"fromAll(); on_any(function(){});log(1);", enabled: true));
            // when
            _newProjectionSource = @"fromAll(); on_any(function(){});log(2);";
            _manager.Handle(
                new ProjectionManagementMessage.UpdateQuery(
                    new PublishEnvelope(_bus), _projectionName, "JS", _newProjectionSource));
        }
 public void it_can_be_created()
 {
     using (var m = new ProjectionManager(new FakePublisher(), new FakePublisher(), new IPublisher[]{new FakePublisher()}))
     {
     }
 }
 public void null_queues_throws_argument_null_exception()
 {
     using (var m = new ProjectionManager(new FakePublisher(), new FakePublisher(), null))
     {
     }
 }
        public void Setup()
        {
            //TODO: this became an integration test - proper ProjectionCoreService and ProjectionManager testing is required as well
            _bus.Subscribe(_consumer);

            _processingQueues = GivenProcessingQueues();
            var queues = _processingQueues.ToDictionary(v => v.Item5, v => (IPublisher)v.Item1);
            _managerMessageDispatcher = new ProjectionManagerMessageDispatcher(queues);
            _manager = new ProjectionManager(
                GetInputQueue(),
                GetInputQueue(),
                queues,
                _timeProvider,
                ProjectionType.All,
                _ioDispatcher,
                _initializeSystemProjections);

            _coordinator = new ProjectionCoreCoordinator(
                ProjectionType.All,
                ProjectionCoreWorkersNode.CreateTimeoutSchedulers(queues.Count),
                queues.Values.ToArray(),
                _bus,
                Envelope);

            _bus.Subscribe<ProjectionManagementMessage.Internal.CleanupExpired>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Internal.Deleted>(_manager);
            _bus.Subscribe<CoreProjectionStatusMessage.Started>(_manager);
            _bus.Subscribe<CoreProjectionStatusMessage.Stopped>(_manager);
            _bus.Subscribe<CoreProjectionStatusMessage.Prepared>(_manager);
            _bus.Subscribe<CoreProjectionStatusMessage.Faulted>(_manager);
            _bus.Subscribe<CoreProjectionStatusMessage.StateReport>(_manager);
            _bus.Subscribe<CoreProjectionStatusMessage.ResultReport>(_manager);
            _bus.Subscribe<CoreProjectionStatusMessage.StatisticsReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.SlaveProjectionReaderAssigned>(_manager);
            _bus.Subscribe<CoreProjectionStatusMessage.ProjectionWorkerStarted>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.Post>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.UpdateQuery>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.GetQuery>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.Delete>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.GetStatistics>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.GetState>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.GetResult>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.Disable>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.Enable>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.Abort>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.SetRunAs>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.Reset>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Command.StartSlaveProjections>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
            _bus.Subscribe<ClientMessage.DeleteStreamCompleted>(_manager);
            _bus.Subscribe<SystemMessage.StateChangeMessage>(_manager);
            _bus.Subscribe<SystemMessage.SystemCoreReady>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.ReaderReady>(_manager);
            _bus.Subscribe(
                CallbackSubscriber.Create<ProjectionManagementMessage.Starting>(
                    starting => _queue.Publish(new ProjectionManagementMessage.ReaderReady())));

            _bus.Subscribe<SystemMessage.StateChangeMessage>(_coordinator);
            _bus.Subscribe<SystemMessage.SystemCoreReady>(_coordinator);

            if (GetInputQueue() != _processingQueues.First().Item2)
            {
                _bus.Subscribe<PartitionProcessingResultBase>(_managerMessageDispatcher);
                _bus.Subscribe<CoreProjectionManagementControlMessage>(
                    _managerMessageDispatcher);
                _bus.Subscribe<PartitionProcessingResultOutputBase>(_managerMessageDispatcher);
                _bus.Subscribe<ReaderSubscriptionManagement.SpoolStreamReading>(_managerMessageDispatcher);
            }

            foreach(var q in _processingQueues)
                SetUpCoreServices(q.Item5, q.Item1, q.Item2, q.Item3, q.Item4);

            //Given();
            WhenLoop();
        }
 public void null_queues_throws_argument_null_exception()
 {
     using (var m = new ProjectionManager(new FakePublisher(), new FakePublisher(), null, checkpointForStatistics: null))
     {
     }
 }
        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);
        }
 public void it_can_be_created()
 {
     using (var m = new ProjectionManager(new FakePublisher(), new FakePublisher(), new IPublisher[]{new FakePublisher()}, checkpointForStatistics: null))
     {
     }
 }
 public void empty_queues_throws_argument_exception()
 {
     using (var m = new ProjectionManager(new FakePublisher(), new FakePublisher(), new IPublisher[0]))
     {
     }
 }
        public void Setup()
        {
            SetUpManualQueue();
            //TODO: this became an integration test - proper ProjectionCoreService and ProjectionManager testing is required as well
            _bus.Subscribe(_consumer);

            _manager = new ProjectionManager(
                GetInputQueue(), GetInputQueue(), new[] {GetInputQueue()}, _timeProvider, RunProjections.All,
                _initializeSystemProjections);
            ICheckpoint writerCheckpoint = new InMemoryCheckpoint(1000);
            _readerService = new EventReaderCoreService(GetInputQueue(), 10, writerCheckpoint, runHeadingReader: true);
            _subscriptionDispatcher =
                new PublishSubscribeDispatcher
                    <ReaderSubscriptionManagement.Subscribe,
                        ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage
                        >(GetInputQueue(), v => v.SubscriptionId, v => v.SubscriptionId);

            _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CheckpointSuggested>());
            _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CommittedEventReceived>());
            _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.EofReached>());
            _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ProgressChanged>());
            _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.NotAuthorized>());

            _coreService = new ProjectionCoreService(GetInputQueue(), GetInputQueue(), _subscriptionDispatcher, _timeProvider);
            _bus.Subscribe<ProjectionManagementMessage.Internal.CleanupExpired>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Internal.Deleted>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Started>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Stopped>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Prepared>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Faulted>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.StateReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.ResultReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.StatisticsReport>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Post>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.UpdateQuery>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetQuery>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Delete>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetStatistics>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetState>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetResult>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Disable>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Enable>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.SetRunAs>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Reset>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe<SystemMessage.StateChangeMessage>(_manager);

            _bus.Subscribe<CoreProjectionManagementMessage.CreateAndPrepare>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.CreatePrepared>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.Dispose>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.Start>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.LoadStopped>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.Stop>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.Kill>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.GetState>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.GetResult>(_coreService);
            _bus.Subscribe<CoreProjectionManagementMessage.UpdateStatistics>(_coreService);
            _bus.Subscribe<CoreProjectionProcessingMessage.CheckpointCompleted>(_coreService);
            _bus.Subscribe<CoreProjectionProcessingMessage.CheckpointLoaded>(_coreService);
            _bus.Subscribe<CoreProjectionProcessingMessage.PrerecordedEventsLoaded>(_coreService);
            _bus.Subscribe<CoreProjectionProcessingMessage.RestartRequested>(_coreService);
            _bus.Subscribe<CoreProjectionProcessingMessage.Failed>(_coreService);
            _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_coreService);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_coreService);
            _bus.Subscribe<ProjectionCoreServiceMessage.StartCore>(_coreService);
            _bus.Subscribe<ProjectionCoreServiceMessage.StopCore>(_coreService);
            _bus.Subscribe<ReaderCoreServiceMessage.StartReader>(_readerService);
            _bus.Subscribe<ReaderCoreServiceMessage.StopReader>(_readerService);
            _bus.Subscribe<ProjectionCoreServiceMessage.CoreTick>(_coreService);
            _bus.Subscribe<ReaderCoreServiceMessage.ReaderTick>(_readerService);
            _bus.Subscribe<ReaderSubscriptionMessage.CommittedEventDistributed>(_readerService);
            _bus.Subscribe<ReaderSubscriptionMessage.EventReaderEof>(_readerService);
            _bus.Subscribe<ReaderSubscriptionMessage.EventReaderNotAuthorized>(_readerService);
            _bus.Subscribe<ReaderSubscriptionMessage.EventReaderIdle>(_readerService);
            _bus.Subscribe<ReaderSubscriptionManagement.Pause>(_readerService);
            _bus.Subscribe<ReaderSubscriptionManagement.Resume>(_readerService);
            _bus.Subscribe<ReaderSubscriptionManagement.Subscribe>(_readerService);
            _bus.Subscribe<ReaderSubscriptionManagement.Unsubscribe>(_readerService);
            
            Given();
            WhenLoop();
        }
 public void null_publisher_throws_argument_null_exception()
 {
     using (var m = new ProjectionManager(new FakePublisher(), null, new IPublisher[] { new FakePublisher() }))
     {
     }
 }
示例#47
0
 private ProjectionManagerNode(IPublisher inputQueue, IPublisher[] queues, ICheckpoint checkpointForStatistics)
 {
     _output = new InMemoryBus("ProjectionManagerOutput");
     _projectionManager = new ProjectionManager(inputQueue, _output, queues, checkpointForStatistics);
 }