/// <inheritdoc /> public async Task <ScopedFilterStreamProcessor> Create( TypeFilterWithEventSourcePartitionDefinition filterDefinition, StreamProcessorId streamProcessorId, CancellationToken cancellationToken) { var processorState = await GetOrCreateStreamProcessorState( streamProcessorId, StreamProcessorState.New, cancellationToken) .ConfigureAwait(false); if (processorState is not StreamProcessorState unpartitionedProcessorState) { throw new ExpectedUnpartitionedStreamProcessorState(streamProcessorId); } // TODO: This is not needed when using the fast event handler. NotifyStream(streamProcessorId.ScopeId, filterDefinition, processorState.Position); return(_createFilterStreamProcessor( _eventLogStream.Subscribe( streamProcessorId.ScopeId, processorState.Position.Value, new ReadOnlyCollection <ArtifactId>(filterDefinition.Types.ToList()), CancellationToken.None), streamProcessorId, filterDefinition.Partitioned, unpartitionedProcessorState)); }
public ScopedFilterStreamProcessor( ChannelReader <EventLogBatch> eventLogStream, StreamProcessorId streamProcessorId, IWriteEventsToStreams eventsWriter, IResilientStreamProcessorStateRepository stateProcessorStates, TenantId tenantId, bool partitioned, StreamProcessorState currentState, ILogger logger) { _eventLogStream = eventLogStream; _streamId = streamProcessorId.EventProcessorId.Value; _eventsWriter = eventsWriter; _stateProcessorStates = stateProcessorStates; _tenantId = tenantId; _partitioned = partitioned; _logger = logger; _currentState = currentState; Identifier = streamProcessorId; }
internal static partial void FilterStreamProcessorUnregistered(this ILogger logger, StreamProcessorId streamProcessorId);
internal static partial void ScopedFilterStreamProcessorFailed(this ILogger logger, Exception ex, StreamProcessorId streamProcessorId);
internal static partial void StartingFilterStreamProcessor(this ILogger logger, StreamProcessorId streamProcessorId);
FilterDefinition <AbstractStreamProcessorState> CreateFilter(StreamProcessorId id) => _streamProcessorFilter.Eq(_ => _.EventProcessor, id.EventProcessorId.Value) & _streamProcessorFilter.Eq(_ => _.SourceStream, id.SourceStreamId.Value);
internal static partial void StreamProcessorUnregistered(ILogger logger, StreamProcessorId streamProcessorId);
internal static partial void StreamProcessorSuccessfullyRegistered(ILogger logger, StreamProcessorId streamProcessorId);
internal static partial void StartingStreamProcessor(ILogger logger, StreamProcessorId streamProcessorId);