public ProjectionProcessingStrategy CreateProjectionProcessingStrategy( string name, ProjectionVersion projectionVersion, ProjectionNamesBuilder namesBuilder, IQueryDefinition sourceDefinition, ProjectionConfig projectionConfig, Func<IProjectionStateHandler> handlerFactory, IProjectionStateHandler stateHandler) { if (!sourceDefinition.DisableParallelismOption && projectionConfig.StopOnEof && sourceDefinition.ByStreams && sourceDefinition.DefinesFold && !string.IsNullOrEmpty(sourceDefinition.CatalogStream)) { return new ParallelQueryProcessingStrategy( name, projectionVersion, stateHandler, handlerFactory, projectionConfig, sourceDefinition, namesBuilder, _logger, _spoolProcessingResponseDispatcher, _subscriptionDispatcher); } if (!sourceDefinition.DisableParallelismOption && projectionConfig.StopOnEof && sourceDefinition.ByStreams && sourceDefinition.DefinesFold && sourceDefinition.HasCategories()) { return new ParallelQueryProcessingStrategy( name, projectionVersion, stateHandler, handlerFactory, projectionConfig, sourceDefinition, namesBuilder, _logger, _spoolProcessingResponseDispatcher, _subscriptionDispatcher); } return projectionConfig.StopOnEof ? (ProjectionProcessingStrategy) new QueryProcessingStrategy( name, projectionVersion, stateHandler, projectionConfig, sourceDefinition, _logger, _subscriptionDispatcher) : new ContinuousProjectionProcessingStrategy( name, projectionVersion, stateHandler, projectionConfig, sourceDefinition, _logger, _subscriptionDispatcher); }
public ParallelQueryProcessingStrategy( string name, ProjectionVersion projectionVersion, IProjectionStateHandler stateHandler, Func <IProjectionStateHandler> handlerFactory, ProjectionConfig projectionConfig, IQueryDefinition sourceDefinition, ProjectionNamesBuilder namesBuilder, ILogger logger, SpooledStreamReadingDispatcher spoolProcessingResponseDispatcher, ReaderSubscriptionDispatcher subscriptionDispatcher) : base(name, projectionVersion, projectionConfig, sourceDefinition, logger, subscriptionDispatcher) { _stateHandler = stateHandler; _projectionConfig = projectionConfig; _sourceDefinition = sourceDefinition; _namesBuilder = namesBuilder; _spoolProcessingResponseDispatcher = spoolProcessingResponseDispatcher; if (_sourceDefinition.CatalogStream == SystemStreams.AllStream) { _catalogStreamName = SystemStreams.AllStream; } else if (_sourceDefinition.HasCategories()) { _catalogStreamName = _namesBuilder.GetCategoryCatalogStreamName(_sourceDefinition.Categories[0]); } else { _catalogStreamName = _sourceDefinition.CatalogStream; } }
public ParallelQueryProcessingStrategy( string name, ProjectionVersion projectionVersion, IProjectionStateHandler stateHandler, Func<IProjectionStateHandler> handlerFactory, ProjectionConfig projectionConfig, IQueryDefinition sourceDefinition, ProjectionNamesBuilder namesBuilder, ILogger logger, SpooledStreamReadingDispatcher spoolProcessingResponseDispatcher, ReaderSubscriptionDispatcher subscriptionDispatcher) : base(name, projectionVersion, projectionConfig, sourceDefinition, logger, subscriptionDispatcher) { _stateHandler = stateHandler; _projectionConfig = projectionConfig; _sourceDefinition = sourceDefinition; _namesBuilder = namesBuilder; _spoolProcessingResponseDispatcher = spoolProcessingResponseDispatcher; if (_sourceDefinition.CatalogStream == SystemStreams.AllStream) { _catalogStreamName = SystemStreams.AllStream; } else if (_sourceDefinition.HasCategories()) { _catalogStreamName = _namesBuilder.GetCategoryCatalogStreamName(_sourceDefinition.Categories[0]); } else { _catalogStreamName = _sourceDefinition.CatalogStream; } }
public ProjectionProcessingStrategy CreateProjectionProcessingStrategy( string name, ProjectionVersion projectionVersion, ProjectionNamesBuilder namesBuilder, IQueryDefinition sourceDefinition, ProjectionConfig projectionConfig, Func <IProjectionStateHandler> handlerFactory, IProjectionStateHandler stateHandler) { if (!sourceDefinition.DisableParallelismOption && projectionConfig.StopOnEof && sourceDefinition.ByStreams && sourceDefinition.DefinesFold && !string.IsNullOrEmpty(sourceDefinition.CatalogStream)) { return(new ParallelQueryProcessingStrategy( name, projectionVersion, stateHandler, handlerFactory, projectionConfig, sourceDefinition, namesBuilder, _logger, _spoolProcessingResponseDispatcher, _subscriptionDispatcher)); } if (!sourceDefinition.DisableParallelismOption && projectionConfig.StopOnEof && sourceDefinition.ByStreams && sourceDefinition.DefinesFold && sourceDefinition.HasCategories()) { return(new ParallelQueryProcessingStrategy( name, projectionVersion, stateHandler, handlerFactory, projectionConfig, sourceDefinition, namesBuilder, _logger, _spoolProcessingResponseDispatcher, _subscriptionDispatcher)); } return(projectionConfig.StopOnEof ? (ProjectionProcessingStrategy) new QueryProcessingStrategy( name, projectionVersion, stateHandler, projectionConfig, sourceDefinition, _logger, _subscriptionDispatcher) : new ContinuousProjectionProcessingStrategy( name, projectionVersion, stateHandler, projectionConfig, sourceDefinition, _logger, _subscriptionDispatcher)); }
protected override IReaderStrategy CreateReaderStrategy(ITimeProvider timeProvider) { if (_sourceDefinition.HasCategories()) { return(new ParallelQueryMasterReaderStrategy( 0, SystemAccount.Principal, timeProvider, _namesBuilder.GetCategoryCatalogStreamName(_sourceDefinition.Categories[0]))); } return(new ParallelQueryMasterReaderStrategy( 0, SystemAccount.Principal, timeProvider, _sourceDefinition.CatalogStream)); }