Esempio n. 1
0
        public async Task Start(string name, CancellationToken cancellationToken)
        {
            var projectionName = new ConnectedProjectionName(name);

            if (!_registeredProjections.Exists(projectionName))
            {
                return; // throw new ArgumentException("Invalid projection name.", nameof(projectionName));
            }
            await _registeredProjections
            .GetProjection(projectionName)
            .UpdateUserDesiredState(UserDesiredState.Started, cancellationToken);

            _commandBus.Queue(new Start(projectionName));
        }
Esempio n. 2
0
        public async Task Start(string id, CancellationToken cancellationToken)
        {
            var projection = _registeredProjections.GetProjection(new ConnectedProjectionIdentifier(id));

            if (projection == null)
            {
                return;
            }

            await projection.UpdateUserDesiredState(UserDesiredState.Started, cancellationToken);

            await projection.ClearErrorMessage(cancellationToken);

            _commandBus.Queue(new Start(projection.Id));
        }
        private void Handle(StartCatchUp startCatchUp)
        {
            var projection = _registeredProjections
                             .GetProjection(startCatchUp?.ProjectionName)
                             ?.Instance;

            Start(projection);
        }
Esempio n. 4
0
        protected override async Task Setup()
        {
            _registeredProjections = Resolve <IRegisteredProjections>();

            await _registeredProjections
            .GetProjection(_projectionToResume)
            .UpdateUserDesiredState(UserDesiredState.Started, CancellationToken.None);
        }
Esempio n. 5
0
        public async Task VerifySetup()
        {
            (await Resolve <IReadonlyStreamStore>().ReadHeadPosition())
            .Should()
            .Be(ExpectedVersion.NoStream);

            (await _registeredProjections
             .GetProjection(_projectionToResume)
             .ShouldResume(CancellationToken.None))
            .Should()
            .BeTrue();

            ProjectionManager
            .GetRegisteredProjections()
            .Should()
            .OnlyContain(connectedProjection => connectedProjection.State == ConnectedProjectionState.Stopped);
        }
Esempio n. 6
0
        private async Task Handle(Subscribe subscribe)
        {
            if (_streamsStoreSubscription.StreamIsRunning)
            {
                var projection = _registeredProjections
                                 .GetProjection(subscribe?.ProjectionName)
                                 ?.Instance;

                Subscribe(projection);
            }
            else
            {
                await StartStream();

                _commandBus.Queue(subscribe.Clone());
            }
        }