/// <summary> /// Initializes a new instance of the <see cref="FailingPartitions"/> class. /// </summary> /// <param name="streamProcessorStates">The <see cref="IResilientStreamProcessorStateRepository" />.</param> /// <param name="eventProcessor">The <see cref="IEventProcessor" />.</param> /// <param name="eventsFromStreamsFetcher">The <see cref="ICanFetchEventsFromPartitionedStream" />.</param> /// <param name="createExecutionContextForEvent">The factory to use to create execution contexts for event processing.</param> /// <param name="eventFetcherPolicies">The policies to use for fetching events.</param> public FailingPartitions( IResilientStreamProcessorStateRepository streamProcessorStates, IEventProcessor eventProcessor, ICanFetchEventsFromPartitionedStream eventsFromStreamsFetcher, Func <StreamEvent, ExecutionContext> createExecutionContextForEvent, //TODO: Oh man, here we go again. IEventFetcherPolicies eventFetcherPolicies) { _streamProcessorStates = streamProcessorStates; _eventProcessor = eventProcessor; _eventsFromStreamsFetcher = eventsFromStreamsFetcher; _createExecutionContextForEvent = createExecutionContextForEvent; _eventFetcherPolicies = eventFetcherPolicies; }
/// <summary> /// Initializes an instance of the <see cref="StreamProcessor" /> class. /// </summary> /// <param name="streamProcessorStates">The <see cref="IResilientStreamProcessorStateRepository" />.</param> /// <param name="externalEventsCommitter">The <see cref="ICommitExternalEvents"/></param> /// <param name="eventsFetcherPolicy">The <see cref="IAsyncPolicyFor{T}"/> <see cref="ICanFetchEventsFromStream" />.</param> /// <param name="metrics">The system for collecting metrics.</param> /// <param name="loggerFactory">The <see cref="ILoggerFactory" />.</param> public StreamProcessorFactory( IResilientStreamProcessorStateRepository streamProcessorStates, ICommitExternalEvents externalEventsCommitter, IEventFetcherPolicies eventsFetcherPolicy, IMetricsCollector metrics, ILoggerFactory loggerFactory ) { _streamProcessorStates = streamProcessorStates; _externalEventsCommitter = externalEventsCommitter; _eventsFetcherPolicy = eventsFetcherPolicy; _metrics = metrics; _loggerFactory = loggerFactory; }
/// <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 a new instance of the <see cref="StreamProcessor"/> class. /// </summary> /// <param name="subscriptionId">The identifier of the subscription the stream processor will receive events for.</param> /// <param name="executionContext">The <see cref="ExecutionContext"/>.</param> /// <param name="eventProcessor">The event processor that writes the received events to a scoped event log.</param> /// <param name="eventsFetcher">The event fetcher that receives fetches events over an event horizon connection.</param> /// <param name="streamProcessorStates">The repository to use for getting the subscription state.</param> /// <param name="eventsFetcherPolicy">The policy around fetching events.</param> /// <param name="metrics">The system for collecting metrics.</param> /// <param name="loggerFactory">The factory for creating loggers.</param> public StreamProcessor( SubscriptionId subscriptionId, ExecutionContext executionContext, IEventProcessor eventProcessor, EventsFromEventHorizonFetcher eventsFetcher, IResilientStreamProcessorStateRepository streamProcessorStates, IEventFetcherPolicies eventsFetcherPolicy, IMetricsCollector metrics, ILoggerFactory loggerFactory) { _identifier = subscriptionId; _executionContext = executionContext; _eventProcessor = eventProcessor; _streamProcessorStates = streamProcessorStates; _eventsFetcher = eventsFetcher; _eventsFetcherPolicy = eventsFetcherPolicy; _metrics = metrics; _loggerFactory = loggerFactory; _logger = loggerFactory.CreateLogger <StreamProcessor>(); }
/// <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; }