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)); }
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); }
protected override async Task Setup() { _registeredProjections = Resolve <IRegisteredProjections>(); await _registeredProjections .GetProjection(_projectionToResume) .UpdateUserDesiredState(UserDesiredState.Started, CancellationToken.None); }
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); }
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()); } }