Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommitWriter"/> class.
 /// </summary>
 /// <param name="streams">The <see cref="IStreams"/>.</param>
 /// <param name="streamWatcher">The <see cref="IStreamEventWatcher"/>.</param>
 /// <param name="commitConverter">The <see cref="IConvertCommitToEvents"/>.</param>
 public CommitWriter(IStreams streams, IStreamEventWatcher streamWatcher, IConvertCommitToEvents commitConverter, IUpdateAggregateVersionsAfterCommit aggregateVersions)
 {
     _streams           = streams;
     _streamWatcher     = streamWatcher;
     _commitConverter   = commitConverter;
     _aggregateVersions = aggregateVersions;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EventsToStreamsWriter"/> class.
 /// </summary>
 /// <param name="streams">The <see cref="IStreams"/>.</param>
 /// <param name="eventConverter">The <see cref="IEventConverter" />.</param>
 /// <param name="streamWatcher">The <see cref="IStreamEventWatcher" />.</param>
 /// <param name="logger">An <see cref="ILogger"/>.</param>
 public EventsToStreamsWriter(IStreams streams, IEventConverter eventConverter, IStreamEventWatcher streamWatcher, ILogger logger)
 {
     _streams        = streams;
     _eventConverter = eventConverter;
     _streamWatcher  = streamWatcher;
     _logger         = logger;
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventHorizonEventsWriter"/> class.
 /// </summary>
 /// <param name="streams">The <see cref="IStreams" />.</param>
 /// <param name="eventsToStreamsWriter">The <see cref="IWriteEventsToStreamCollection" />.</param>
 /// <param name="eventConverter">The <see cref="IEventConverter" />.</param>
 /// <param name="streamWatcher">The <see cref="IStreamEventWatcher" />.</param>
 /// <param name="logger">The <see cref="ILogger" />.</param>
 public EventHorizonEventsWriter(IStreams streams, IWriteEventsToStreamCollection eventsToStreamsWriter, IEventConverter eventConverter, IStreamEventWatcher streamWatcher, ILogger logger)
 {
     _streams = streams;
     _eventsToStreamsWriter = eventsToStreamsWriter;
     _eventConverter        = eventConverter;
     _streamWatcher         = streamWatcher;
     _logger = logger;
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateScopedFilterStreamProcessors"/> class.
 /// </summary>
 /// <param name="streamProcessorStates">The stream processor states repository to use to get or create the current state of the stream processor.</param>
 /// <param name="streamWatcher">The stream watcher to use to notify waiters when the stream processor is created..</param>
 /// <param name="eventLogStream">The <see cref="IEventLogStream"/>.</param>
 /// <param name="createFilterStreamProcessor">The factory to use to create instances of unpartitioned stream processors.</param>
 public CreateScopedFilterStreamProcessors(
     IResilientStreamProcessorStateRepository streamProcessorStates,
     IStreamEventWatcher streamWatcher,
     IEventLogStream eventLogStream,
     Func <ChannelReader <EventLogBatch>, StreamProcessorId, bool, StreamProcessorState, ScopedFilterStreamProcessor> createFilterStreamProcessor)
 {
     _streamProcessorStates       = streamProcessorStates;
     _streamWatcher               = streamWatcher;
     _eventLogStream              = eventLogStream;
     _createFilterStreamProcessor = createFilterStreamProcessor;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateScopedStreamProcessors"/> class.
 /// </summary>
 /// <param name="eventFetchers">The factory to use to create the partitioned or unpartitioned stream event fetchers.</param>
 /// <param name="streamProcessorStates">The stream processor states repository to use to get or create the current state of the stream processor.</param>
 /// <param name="streamWatcher">The stream watcher to use to notify waiters when the stream processor is created..</param>
 /// <param name="createPartitionedStreamProcessor">The factory to use to create instances of partitioned stream processors.</param>
 /// <param name="createUnpartitionedStreamProcessor">The factory to use to create instances of unpartitioned stream processors.</param>
 public CreateScopedStreamProcessors(
     IEventFetchers eventFetchers,
     IResilientStreamProcessorStateRepository streamProcessorStates,
     IStreamEventWatcher streamWatcher,
     Func <IStreamDefinition, IStreamProcessorId, ICanFetchEventsFromPartitionedStream, IEventProcessor, Partitioned.StreamProcessorState, ExecutionContext, Partitioned.ScopedStreamProcessor> createPartitionedStreamProcessor,
     Func <IStreamDefinition, IStreamProcessorId, ICanFetchEventsFromStream, IEventProcessor, StreamProcessorState, ExecutionContext, ScopedStreamProcessor> createUnpartitionedStreamProcessor)
 {
     _eventFetchers                      = eventFetchers;
     _streamProcessorStates              = streamProcessorStates;
     _streamWatcher                      = streamWatcher;
     _createPartitionedStreamProcessor   = createPartitionedStreamProcessor;
     _createUnpartitionedStreamProcessor = createUnpartitionedStreamProcessor;
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScopedStreamProcessor"/> class.
 /// </summary>
 /// <param name="tenantId">The <see cref="TenantId"/>.</param>
 /// <param name="streamProcessorId">The <see cref="IStreamProcessorId" />.</param>
 /// <param name="sourceStreamDefinition">The source stream <see cref="IStreamDefinition" />.</param>
 /// <param name="initialState">The <see cref="StreamProcessorState" />.</param>
 /// <param name="processor">An <see cref="IEventProcessor" /> to process the event.</param>
 /// <param name="streamProcessorStates">The <see cref="IResilientStreamProcessorStateRepository" />.</param>
 /// <param name="eventsFromStreamsFetcher">The<see cref="ICanFetchEventsFromStream" />.</param>
 /// <param name="executionContext">The <see cref="ExecutionContext"/> of the stream processor.</param>
 /// <param name="eventFetcherPolicies">The policies to use while fetching events.</param>
 /// <param name="eventWatcher">The <see cref="IStreamEventWatcher" /> to wait for events to be available in stream.</param>
 /// <param name="timeToRetryGetter">The <see cref="ICanGetTimeToRetryFor{T}" /> <see cref="StreamProcessorState" />.</param>
 /// <param name="logger">An <see cref="ILogger" /> to log messages.</param>
 public ScopedStreamProcessor(
     TenantId tenantId,
     IStreamProcessorId streamProcessorId,
     IStreamDefinition sourceStreamDefinition,
     StreamProcessorState initialState,
     IEventProcessor processor,
     IResilientStreamProcessorStateRepository streamProcessorStates,
     ICanFetchEventsFromStream eventsFromStreamsFetcher,
     ExecutionContext executionContext,
     IEventFetcherPolicies eventFetcherPolicies,
     IStreamEventWatcher eventWatcher,
     ICanGetTimeToRetryFor <StreamProcessorState> timeToRetryGetter,
     ILogger logger)
     : base(tenantId, streamProcessorId, sourceStreamDefinition, initialState, processor, eventsFromStreamsFetcher, executionContext, eventFetcherPolicies, eventWatcher, logger)
 {
     _streamProcessorStates = streamProcessorStates;
     _timeToRetryGetter     = timeToRetryGetter;
 }
 /// <summary>
 /// Initializes an instance of the <see cref="EmbeddingProcessorFactory" /> class.
 /// </summary>
 public EmbeddingProcessorFactory(
     TenantId tenant,
     IEventStore eventStore,
     IFetchCommittedEvents committedEventsFetcher,
     IEmbeddingStore embeddingStore,
     IStreamEventWatcher streamEventWatcher,
     ICompareStates stateComparer,
     IDetectEmbeddingLoops loopDetector,
     ILoggerFactory loggerFactory
     )
 {
     _tenant                 = tenant;
     _eventStore             = eventStore;
     _committedEventsFetcher = committedEventsFetcher;
     _embeddingStore         = embeddingStore;
     _streamEventWatcher     = streamEventWatcher;
     _stateComparer          = stateComparer;
     _loopDetector           = loopDetector;
     _loggerFactory          = loggerFactory;
 }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScopedStreamProcessor"/> class.
 /// </summary>
 /// <param name="tenantId">The <see cref="TenantId"/>.</param>
 /// <param name="streamProcessorId">The <see cref="IStreamProcessorId" />.</param>
 /// <param name="sourceStreamDefinition">The source stream <see cref="StreamDefinition" />.</param>
 /// <param name="initialState">The <see cref="StreamProcessorState" />.</param>
 /// <param name="processor">An <see cref="IEventProcessor" /> to process the event.</param>
 /// <param name="streamProcessorStates">The <see cref="IResilientStreamProcessorStateRepository" />.</param>
 /// <param name="eventsFromStreamsFetcher">The<see cref="ICanFetchEventsFromStream" />.</param>
 /// <param name="executionContext">The <see cref="ExecutionContext"/> of the stream processor.</param>
 /// <param name="failingPartitionsFactory">The factory to use to create the <see cref="IFailingPartitions" />.</param>
 /// <param name="eventFetcherPolicies">The policies to use while fetching events.</param>
 /// <param name="streamWatcher">The <see cref="IStreamEventWatcher" />.</param>
 /// <param name="timeToRetryGetter">The <see cref="ICanGetTimeToRetryFor{T}" /> <see cref="StreamProcessorState" />.</param>
 /// <param name="logger">An <see cref="ILogger" /> to log messages.</param>
 public ScopedStreamProcessor(
     TenantId tenantId,
     IStreamProcessorId streamProcessorId,
     IStreamDefinition sourceStreamDefinition,
     StreamProcessorState initialState,
     IEventProcessor processor,
     IResilientStreamProcessorStateRepository streamProcessorStates,
     ICanFetchEventsFromPartitionedStream eventsFromStreamsFetcher,
     ExecutionContext executionContext,
     Func <IEventProcessor, ICanFetchEventsFromPartitionedStream, Func <StreamEvent, ExecutionContext>, IFailingPartitions> failingPartitionsFactory,
     IEventFetcherPolicies eventFetcherPolicies,
     IStreamEventWatcher streamWatcher,
     ICanGetTimeToRetryFor <StreamProcessorState> timeToRetryGetter,
     ILogger logger)
     : base(tenantId, streamProcessorId, sourceStreamDefinition, initialState, processor, eventsFromStreamsFetcher, executionContext, eventFetcherPolicies, streamWatcher, logger)
 {
     _streamProcessorStates = streamProcessorStates;
     _failingPartitions     = failingPartitionsFactory(processor, eventsFromStreamsFetcher, GetExecutionContextForEvent);
     _timeToRetryGetter     = timeToRetryGetter;
 }