private void CreateCoreProjection(
            Guid projectionCorrelationId, IPrincipal runAs, ProjectionProcessingStrategy processingStrategy)
        {
            var projection = processingStrategy.Create(
                projectionCorrelationId, _inputQueue, runAs, _publisher, _ioDispatcher, _subscriptionDispatcher,
                _timeProvider);

            _projections.Add(projectionCorrelationId, projection);
        }
 protected virtual CoreProjection GivenCoreProjection(ProjectionProcessingStrategy projectionProcessingStrategy)
 {
     return projectionProcessingStrategy.Create(
         _projectionCorrelationId,
         _bus,
         _workerId,
         SystemAccount.Principal,
         _bus,
         _ioDispatcher,
         _subscriptionDispatcher,
         _timeProvider);
 }
Exemple #3
0
        //NOTE: this is only for slave projections (TBD)


        public CoreProjection(
            ProjectionProcessingStrategy projectionProcessingStrategy, ProjectionVersion version,
            Guid projectionCorrelationId, IPublisher inputQueue, IPrincipal runAs, IPublisher publisher, IODispatcher ioDispatcher,
            ReaderSubscriptionDispatcher subscriptionDispatcher, ILogger logger, ProjectionNamesBuilder namingBuilder, CoreProjectionCheckpointWriter coreProjectionCheckpointWriter,
            PartitionStateCache partitionStateCache, string effectiveProjectionName, ITimeProvider timeProvider, bool isSlaveProjection)
        {
            if (publisher == null)
            {
                throw new ArgumentNullException("publisher");
            }
            if (ioDispatcher == null)
            {
                throw new ArgumentNullException("ioDispatcher");
            }
            if (subscriptionDispatcher == null)
            {
                throw new ArgumentNullException("subscriptionDispatcher");
            }

            _projectionProcessingStrategy = projectionProcessingStrategy;
            _projectionCorrelationId      = projectionCorrelationId;
            _inputQueue            = inputQueue;
            _runAs                 = runAs;
            _name                  = effectiveProjectionName;
            _version               = version;
            _stopOnEof             = projectionProcessingStrategy.GetStopOnEof();
            _logger                = logger;
            _publisher             = publisher;
            _partitionStateCache   = partitionStateCache;
            _requiresRootPartition = projectionProcessingStrategy.GetRequiresRootPartition();
            _isSlaveProjection     = isSlaveProjection;
            var useCheckpoints = projectionProcessingStrategy.GetUseCheckpoints();

            _coreProjectionCheckpointWriter = coreProjectionCheckpointWriter;

            _projectionProcessingPhases = projectionProcessingStrategy.CreateProcessingPhases(
                publisher, projectionCorrelationId, partitionStateCache, UpdateStatistics, this, namingBuilder,
                timeProvider, ioDispatcher, coreProjectionCheckpointWriter);


            //NOTE: currently assuming the first checkpoint manager to be able to load any state
            _checkpointReader = new CoreProjectionCheckpointReader(
                publisher, _projectionCorrelationId, ioDispatcher, namingBuilder.MakeCheckpointStreamName(), _version,
                useCheckpoints);
            _enrichStatistics = projectionProcessingStrategy.EnrichStatistics;
            GoToState(State.Initial);
        }