protected override void Given()
        {
            _projectionId   = Guid.NewGuid();
            _workerId       = Guid.NewGuid();
            _projectionName = "projection";
            _handlerType    = "JS";
            _query          = "from()";

            _config = new ProjectionConfig(
                new OpenGenericPrincipal("user", "a", "b"),
                1000,
                100000,
                2000,
                200,
                true,
                true,
                true,
                true,
                true,
                true,
                10000,
                1);

            var builder = new SourceDefinitionBuilder();

            builder.FromStream("s1");
            builder.FromStream("s2");
            builder.IncludeEvent("e1");
            builder.IncludeEvent("e2");
            builder.SetByStream();
            builder.SetResultStreamNameOption("result-stream");
            _definition = QuerySourcesDefinition.From(builder);
        }
コード例 #2
0
        protected override ProjectionProcessingStrategy GivenProjectionProcessingStrategy()
        {
            var sourceDefinition = _stateHandler.GetSourceDefinition();
            var source           = QuerySourcesDefinition.From(sourceDefinition).ToJson();

            return(new ParallelQueryProcessingStrategy(
                       _projectionName, _version, GivenProjectionStateHandler, _projectionConfig,
                       ProjectionSourceDefinition.From(
                           _projectionName, sourceDefinition, typeof(FakeProjectionStateHandler).GetNativeHandlerName(),
                           source), new ProjectionNamesBuilder(_projectionName, sourceDefinition), null,
                       _spoolProcessingResponseDispatcher, _subscriptionDispatcher));
        }
コード例 #3
0
        public void Handle(CoreProjectionManagementMessage.CreatePrepared message)
        {
            var command = new CreatePreparedCommand {
                Config           = new PersistedProjectionConfig(message.Config),
                HandlerType      = message.HandlerType,
                Id               = message.ProjectionId.ToString("N"),
                Name             = message.Name,
                Query            = message.Query,
                SourceDefinition = QuerySourcesDefinition.From(message.SourceDefinition),
                Version          = message.Version
            };

            _commandWriter.PublishResponse("$create-prepared", message.WorkerId, command);
        }
コード例 #4
0
        private CoreProjectionManagementMessage.CreatePrepared CreateBeginCreatePreparedMessage(ProjectionConfig config)
        {
            if (_persistedState.SourceDefinition == null)
            {
                throw new Exception(
                          "The projection cannot be loaded as stopped as it was stored in the old format.  Update the projection query text to force prepare");
            }

            var createProjectionMessage = new CoreProjectionManagementMessage.CreatePrepared(
                Id,
                _workerId,
                _name,
                new ProjectionVersion(_projectionId, _persistedState.Epoch ?? 0, _persistedState.Version ?? 1),
                config,
                QuerySourcesDefinition.From(_persistedState.SourceDefinition),
                HandlerType,
                Query);

            return(createProjectionMessage);
        }
コード例 #5
0
 public IQuerySources Build()
 {
     return(QuerySourcesDefinition.From(this));
 }