public FetchDirective ShouldFetch(PipelineState currentState) { if (currentState.PendingEventCount < _minimumPendingEvents) { return(FetchDirective.FetchNow(Guid.NewGuid(), _batchSize)); } return(FetchDirective.DoNotFetchYet()); }
private void Fetch(FetchDirective directive) { lock (_fetchLock) { _activeFetchRequest = true; var elements = _elementStore.Fetch(_pipelineName, directive.MaxCount); foreach (var element in elements) { element.SequenceNumber = _sequence++; OnElementFetched(new ElementFetchedEventArgs(element)); } _activeFetchRequest = false; } }
private void StartFetching(FetchDirective directive) { Task.Factory.StartNew(() => Fetch(directive)); }