protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases( IPublisher publisher, Guid projectionCorrelationId, ProjectionNamesBuilder namingBuilder, PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher, IProjectionProcessingPhase firstPhase) { return(new [] { firstPhase }); }
public override sealed IProjectionProcessingPhase[] CreateProcessingPhases( IPublisher publisher, Guid projectionCorrelationId, PartitionStateCache partitionStateCache, Action updateStatistics, CoreProjection coreProjection, ProjectionNamesBuilder namingBuilder, ITimeProvider timeProvider, IODispatcher ioDispatcher, CoreProjectionCheckpointWriter coreProjectionCheckpointWriter) { var definesFold = _sourceDefinition.DefinesFold; var readerStrategy = CreateReaderStrategy(timeProvider); var zeroCheckpointTag = readerStrategy.PositionTagger.MakeZeroCheckpointTag(); var checkpointManager = CreateCheckpointManager( projectionCorrelationId, publisher, ioDispatcher, namingBuilder, coreProjectionCheckpointWriter, definesFold, readerStrategy); var resultWriter = CreateFirstPhaseResultWriter( checkpointManager as IEmittedEventWriter, zeroCheckpointTag, namingBuilder); var firstPhase = CreateFirstProcessingPhase( publisher, projectionCorrelationId, partitionStateCache, updateStatistics, coreProjection, _subscriptionDispatcher, zeroCheckpointTag, checkpointManager, readerStrategy, resultWriter); return(CreateProjectionProcessingPhases( publisher, projectionCorrelationId, namingBuilder, partitionStateCache, coreProjection, ioDispatcher, firstPhase)); }
protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases( IPublisher publisher, Guid projectionCorrelationId, ProjectionNamesBuilder namingBuilder, PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher, IProjectionProcessingPhase firstPhase) { var coreProjectionCheckpointWriter = new CoreProjectionCheckpointWriter( namingBuilder.MakeCheckpointStreamName(), ioDispatcher, _projectionVersion, _name); var checkpointManager2 = new DefaultCheckpointManager( publisher, projectionCorrelationId, _projectionVersion, _projectionConfig.RunAs, ioDispatcher, _projectionConfig, _name, new PhasePositionTagger(1), namingBuilder, GetUseCheckpoints(), false, _sourceDefinition.DefinesFold, coreProjectionCheckpointWriter); IProjectionProcessingPhase writeResultsPhase; if (GetProducesRunningResults() || !string.IsNullOrEmpty(_sourceDefinition.CatalogStream) && _sourceDefinition.ByStreams) { writeResultsPhase = new WriteQueryEofProjectionProcessingPhase( 1, namingBuilder.GetResultStreamName(), coreProjection, partitionStateCache, checkpointManager2, checkpointManager2); } else { writeResultsPhase = new WriteQueryResultProjectionProcessingPhase( 1, namingBuilder.GetResultStreamName(), coreProjection, partitionStateCache, checkpointManager2, checkpointManager2); } return(new[] { firstPhase, writeResultsPhase }); }
protected override IProjectionProcessingPhase CreateFirstProcessingPhase( IPublisher publisher, IPublisher inputQueue, Guid projectionCorrelationId, PartitionStateCache partitionStateCache, Action updateStatistics, CoreProjection coreProjection, ReaderSubscriptionDispatcher subscriptionDispatcher, CheckpointTag zeroCheckpointTag, ICoreProjectionCheckpointManager checkpointManager, IReaderStrategy readerStrategy, IResultWriter resultWriter, IEmittedStreamsTracker emittedStreamsTracker) { return(new ParallelQueryMasterProjectionProcessingPhase( coreProjection, projectionCorrelationId, publisher, inputQueue, _projectionConfig, updateStatistics, _stateHandler, partitionStateCache, _name, _logger, zeroCheckpointTag, checkpointManager, subscriptionDispatcher, readerStrategy, resultWriter, _projectionConfig.CheckpointsEnabled, this.GetStopOnEof(), _spoolProcessingResponseDispatcher, emittedStreamsTracker)); }
public CommittedEventWorkItem( CoreProjection projection, ProjectionMessage.Projections.CommittedEventReceived message, string partition) : base(projection, message.EventStreamId) { _message = message; _partition = partition; }
public ProgressWorkItem( CoreProjection projection, ICoreProjectionCheckpointManager checkpointManager, float progress) : base(projection, null) { _checkpointManager = checkpointManager; _progress = progress; }
public CheckpointSuggestedWorkItem( CoreProjection projection, ProjectionMessage.Projections.CheckpointSuggested message, CoreProjectionCheckpointManager checkpointManager) : base(projection, "") // checkpoints are serialized based on string.empty token stream name { _message = message; _checkpointManager = checkpointManager; }
public CheckpointSuggestedWorkItem( CoreProjection projection, ProjectionMessage.Projections.CheckpointSuggested message, CheckpointTag tag) : base("") { _projection = projection; _message = message; _tag = tag; }
public CommittedEventWorkItem( CoreProjection projection, EventReaderSubscriptionMessage.CommittedEventReceived message, StatePartitionSelector statePartitionSelector) : base(projection, null) { _statePartitionSelector = statePartitionSelector; _message = message; }
protected abstract IProjectionProcessingPhase[] CreateProjectionProcessingPhases( IPublisher publisher, IPublisher inputQueue, Guid projectionCorrelationId, ProjectionNamesBuilder namingBuilder, PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher, IProjectionProcessingPhase firstPhase);
public CheckpointSuggestedWorkItem( CoreProjection projection, EventReaderSubscriptionMessage.CheckpointSuggested message, ICoreProjectionCheckpointManager checkpointManager) : base(projection) { _projection = projection; _message = message; _checkpointManager = checkpointManager; }
public CommittedEventWorkItem( CoreProjection projection, ProjectionMessage.Projections.CommittedEventReceived message, string partition, CheckpointTag tag) : base(message.EventStreamId) { _projection = projection; _message = message; _partition = partition; _tag = tag; }
public abstract IProjectionProcessingPhase[] CreateProcessingPhases( IPublisher publisher, IPublisher inputQueue, Guid projectionCorrelationId, PartitionStateCache partitionStateCache, Action updateStatistics, CoreProjection coreProjection, ProjectionNamesBuilder namingBuilder, ITimeProvider timeProvider, IODispatcher ioDispatcher, CoreProjectionCheckpointWriter coreProjectionCheckpointWriter);
protected abstract IProjectionProcessingPhase CreateFirstProcessingPhase( IPublisher publisher, IPublisher inputQueue, Guid projectionCorrelationId, PartitionStateCache partitionStateCache, Action updateStatistics, CoreProjection coreProjection, ReaderSubscriptionDispatcher subscriptionDispatcher, CheckpointTag zeroCheckpointTag, ICoreProjectionCheckpointManager checkpointManager, IReaderStrategy readerStrategy, IResultWriter resultWriter);
public EventProcessingProjectionProcessingPhase( CoreProjection coreProjection, Guid projectionCorrelationId, IPublisher publisher, IPublisher inputQueue, ProjectionConfig projectionConfig, Action updateStatistics, IProjectionStateHandler projectionStateHandler, PartitionStateCache partitionStateCache, bool definesStateTransform, string projectionName, ILogger logger, CheckpointTag zeroCheckpointTag, ICoreProjectionCheckpointManager coreProjectionCheckpointManager, StatePartitionSelector statePartitionSelector, ReaderSubscriptionDispatcher subscriptionDispatcher, IReaderStrategy readerStrategy, IResultWriter resultWriter, bool useCheckpoints, bool stopOnEof, bool isBiState, bool orderedPartitionProcessing, IEmittedStreamsTracker emittedStreamsTracker, bool enableContentTypeValidation) : base( publisher, inputQueue, coreProjection, projectionCorrelationId, coreProjectionCheckpointManager, projectionConfig, projectionName, logger, zeroCheckpointTag, partitionStateCache, resultWriter, updateStatistics, subscriptionDispatcher, readerStrategy, useCheckpoints, stopOnEof, orderedPartitionProcessing, isBiState, emittedStreamsTracker, enableContentTypeValidation) { _projectionStateHandler = projectionStateHandler; _definesStateTransform = definesStateTransform; _statePartitionSelector = statePartitionSelector; _isBiState = isBiState; _stopwatch = new Stopwatch(); }
protected override IProjectionProcessingPhase CreateFirstProcessingPhase( IPublisher publisher, Guid projectionCorrelationId, PartitionStateCache partitionStateCache, Action updateStatistics, CoreProjection coreProjection, ReaderSubscriptionDispatcher subscriptionDispatcher, CheckpointTag zeroCheckpointTag, ICoreProjectionCheckpointManager checkpointManager, IReaderStrategy readerStrategy, IResultWriter resultWriter) { var statePartitionSelector = CreateStatePartitionSelector( _stateHandler, _sourceDefinition.ByCustomPartitions, _sourceDefinition.ByStreams); return(new EventProcessingProjectionProcessingPhase( coreProjection, projectionCorrelationId, publisher, _projectionConfig, updateStatistics, _stateHandler, partitionStateCache, _sourceDefinition.DefinesStateTransform, _name, _logger, zeroCheckpointTag, checkpointManager, statePartitionSelector, subscriptionDispatcher, readerStrategy, resultWriter, _projectionConfig.CheckpointsEnabled, this.GetStopOnEof())); }
public ParallelQueryMasterProjectionProcessingPhase( CoreProjection coreProjection, Guid projectionCorrelationId, IPublisher publisher, ProjectionConfig projectionConfig, Action updateStatistics, PartitionStateCache partitionStateCache, string name, ILogger logger, CheckpointTag zeroCheckpointTag, ICoreProjectionCheckpointManager checkpointManager, ReaderSubscriptionDispatcher subscriptionDispatcher, IReaderStrategy readerStrategy, IResultWriter resultWriter, bool checkpointsEnabled, bool stopOnEof, SpooledStreamReadingDispatcher spoolProcessingResponseDispatcher) : base( publisher, coreProjection, projectionCorrelationId, checkpointManager, projectionConfig, name, logger, zeroCheckpointTag, partitionStateCache, resultWriter, updateStatistics, subscriptionDispatcher, readerStrategy, checkpointsEnabled, stopOnEof) { _spoolProcessingResponseDispatcher = spoolProcessingResponseDispatcher; }
public void Handle(ProjectionMessage.CoreService.Management.Create message) { try { //TODO: factory method can throw! IProjectionStateHandler stateHandler = message.HandlerFactory(); // constructor can fail if wrong source defintion //TODO: revise it var projection = new CoreProjection(message.Name, message.CorrelationId, _publisher, stateHandler, message.Config, _readDispatcher, _writeDispatcher, _logger); _projections.Add(message.CorrelationId, projection); } catch (Exception ex) { message.Envelope.ReplyWith(new ProjectionMessage.Projections.StatusReport.Faulted(message.CorrelationId, ex.Message)); } }
public ParallelQueryMasterProjectionProcessingPhase( CoreProjection coreProjection, Guid projectionCorrelationId, IPublisher publisher, IPublisher inputQueue, ProjectionConfig projectionConfig, Action updateStatistics, IProjectionStateHandler stateHandler, PartitionStateCache partitionStateCache, string name, ILogger logger, CheckpointTag zeroCheckpointTag, ICoreProjectionCheckpointManager checkpointManager, ReaderSubscriptionDispatcher subscriptionDispatcher, IReaderStrategy readerStrategy, IResultWriter resultWriter, bool checkpointsEnabled, bool stopOnEof, SpooledStreamReadingDispatcher spoolProcessingResponseDispatcher, IEmittedStreamsTracker emittedStreamsTracker) : base( publisher, inputQueue, coreProjection, projectionCorrelationId, checkpointManager, projectionConfig, name, logger, zeroCheckpointTag, partitionStateCache, resultWriter, updateStatistics, subscriptionDispatcher, readerStrategy, checkpointsEnabled, stopOnEof, orderedPartitionProcessing: true, isBiState: false, emittedStreamsTracker: emittedStreamsTracker) { _stateHandler = stateHandler; _spoolProcessingResponseDispatcher = spoolProcessingResponseDispatcher; _spoolProcessingWorkItems = new Dictionary <Guid, SpoolStreamProcessingWorkItem>(); }
public EventProcessingProjectionProcessingPhase( CoreProjection coreProjection, Guid projectionCorrelationId, IPublisher publisher, ProjectionConfig projectionConfig, Action updateStatistics, IProjectionStateHandler projectionStateHandler, PartitionStateCache partitionStateCache, bool definesStateTransform, string projectionName, ILogger logger, CheckpointTag zeroCheckpointTag, ICoreProjectionCheckpointManager coreProjectionCheckpointManager, StatePartitionSelector statePartitionSelector, ReaderSubscriptionDispatcher subscriptionDispatcher, IReaderStrategy readerStrategy, IResultWriter resultWriter, bool useCheckpoints, bool stopOnEof) : base( publisher, coreProjection, projectionCorrelationId, coreProjectionCheckpointManager, projectionConfig, projectionName, logger, zeroCheckpointTag, partitionStateCache, resultWriter, updateStatistics, subscriptionDispatcher, readerStrategy, useCheckpoints, stopOnEof) { _projectionStateHandler = projectionStateHandler; _definesStateTransform = definesStateTransform; _statePartitionSelector = statePartitionSelector; _stopwatch = new Stopwatch(); }
protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases( IPublisher publisher, IPublisher inputQueue, Guid projectionCorrelationId, ProjectionNamesBuilder namingBuilder, PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher, IProjectionProcessingPhase firstPhase) { var coreProjectionCheckpointWriter = new CoreProjectionCheckpointWriter( namingBuilder.MakeCheckpointStreamName(), ioDispatcher, _projectionVersion, _name); var checkpointManager2 = new DefaultCheckpointManager( publisher, projectionCorrelationId, _projectionVersion, SystemAccount.Principal, ioDispatcher, _projectionConfig, _name, new PhasePositionTagger(1), namingBuilder, GetUseCheckpoints(), false, _sourceDefinition.DefinesFold, coreProjectionCheckpointWriter); IProjectionProcessingPhase writeResultsPhase; if (GetProducesRunningResults()) { writeResultsPhase = new WriteQueryEofProjectionProcessingPhase( publisher, 1, namingBuilder.GetResultStreamName(), coreProjection, partitionStateCache, checkpointManager2, checkpointManager2, firstPhase.EmittedStreamsTracker); } else { writeResultsPhase = new WriteQueryResultProjectionProcessingPhase( publisher, 1, namingBuilder.GetResultStreamName(), coreProjection, partitionStateCache, checkpointManager2, checkpointManager2, firstPhase.EmittedStreamsTracker); } return(new[] { firstPhase, writeResultsPhase }); }
protected override IProjectionProcessingPhase CreateFirstProcessingPhase( IPublisher publisher, IPublisher inputQueue, Guid projectionCorrelationId, PartitionStateCache partitionStateCache, Action updateStatistics, CoreProjection coreProjection, ReaderSubscriptionDispatcher subscriptionDispatcher, CheckpointTag zeroCheckpointTag, ICoreProjectionCheckpointManager checkpointManager, IReaderStrategy readerStrategy, IResultWriter resultWriter, IEmittedStreamsTracker emittedStreamsTracker) { var statePartitionSelector = CreateStatePartitionSelector(); var orderedPartitionProcessing = _sourceDefinition.ByStreams && _sourceDefinition.IsBiState; return(new EventProcessingProjectionProcessingPhase( coreProjection, projectionCorrelationId, publisher, inputQueue, _projectionConfig, updateStatistics, _stateHandler, partitionStateCache, _sourceDefinition.DefinesStateTransform, _name, _logger, zeroCheckpointTag, checkpointManager, statePartitionSelector, subscriptionDispatcher, readerStrategy, resultWriter, _projectionConfig.CheckpointsEnabled, this.GetStopOnEof(), _sourceDefinition.IsBiState, orderedPartitionProcessing: orderedPartitionProcessing, emittedStreamsTracker: emittedStreamsTracker, enableContentTypeValidation: _enableContentTypeValidation)); }
public void Handle(CoreProjectionManagementMessage.CreatePrepared message) { try { //TODO: factory method can throw! // constructor can fail if wrong source defintion ProjectionSourceDefinition sourceDefinition; var projection = CoreProjection.CreatePrepared( message.Name, message.Version, message.ProjectionId, _publisher, message.SourceDefinition, message.Config, _readDispatcher, _writeDispatcher, _subscriptionDispatcher, _logger, _timeProvider, out sourceDefinition); _projections.Add(message.ProjectionId, projection); message.Envelope.ReplyWith( new CoreProjectionManagementMessage.Prepared(message.ProjectionId, sourceDefinition)); } catch (Exception ex) { message.Envelope.ReplyWith( new CoreProjectionManagementMessage.Faulted(message.ProjectionId, ex.Message)); } }
protected GetDataWorkItemBase( IEnvelope envelope, Guid correlationId, Guid projectionId, CoreProjection projection, PartitionStateCache partitionStateCache, string partition) : base(projection, null) { if (envelope == null) { throw new ArgumentNullException("envelope"); } if (partitionStateCache == null) { throw new ArgumentNullException("partitionStateCache"); } if (partition == null) { throw new ArgumentNullException("partition"); } _partition = partition; _envelope = envelope; _correlationId = correlationId; _projectionId = projectionId; _partitionStateCache = partitionStateCache; }
public void Handle(CoreProjectionManagementMessage.CreateAndPrepare message) { try { //TODO: factory method can throw! IProjectionStateHandler stateHandler = message.HandlerFactory(); // constructor can fail if wrong source defintion //TODO: revise it var sourceDefintionRecorder = new SourceDefintionRecorder(); stateHandler.ConfigureSourceProcessingStrategy(sourceDefintionRecorder); var sourceDefintion = sourceDefintionRecorder.Build(); var projection = new CoreProjection( message.Name, message.CorrelationId, _publisher, stateHandler, message.Config, _readDispatcher, _writeDispatcher, _logger); _projections.Add(message.CorrelationId, projection); message.Envelope.ReplyWith( new CoreProjectionManagementMessage.Prepared(message.CorrelationId, sourceDefintion)); } catch (Exception ex) { message.Envelope.ReplyWith( new CoreProjectionManagementMessage.Faulted(message.CorrelationId, ex.Message)); } }
public GetStateWorkItem(IEnvelope envelope, Guid projectionId, CoreProjection projection, PartitionStateCache partitionStateCache, string partition) : base(projection, string.Empty) { if (envelope == null) { throw new ArgumentNullException("envelope"); } if (partitionStateCache == null) { throw new ArgumentNullException("partitionStateCache"); } if (partition == null) { throw new ArgumentNullException("partition"); } _partition = partition; _envelope = envelope; _projectionId = projectionId; _partitionStateCache = partitionStateCache; }
public NotAuthorizedWorkItem(CoreProjection projection) : base(projection, null) { }
public GetResultWorkItem( IEnvelope envelope, Guid correlationId, Guid projectionId, CoreProjection projection, PartitionStateCache partitionStateCache, string partition) : base(envelope, correlationId, projectionId, projection, partitionStateCache, partition) { }
protected WorkItem(CoreProjection projection, string stream) : base(stream) { _projection = projection; _lastStage = 2; }
protected WorkItem(CoreProjection projection, object initialCorrelationId) : base(initialCorrelationId) { Projection = projection; _lastStage = 5; }