public AutoCheckPointTests() { changeFeedObserver = Mock.Of <IChangeFeedObserver>(); partitionCheckpointer = Mock.Of <IPartitionCheckpointer>(); Mock.Get(partitionCheckpointer) .Setup(checkPointer => checkPointer.CheckpointPartitionAsync(It.IsAny <string>())) .Returns(Task.CompletedTask); checkpointFrequency = new CheckpointFrequency(); sut = new AutoCheckpointer(checkpointFrequency, changeFeedObserver); documents = Mock.Of <IReadOnlyList <Document> >(); feedResponse = Mock.Of <IFeedResponse <Document> >(); Mock.Get(feedResponse) .Setup(response => response.Count) .Returns(documents.Count); Mock.Get(feedResponse) .Setup(response => response.ResponseContinuation) .Returns("token"); Mock.Get(feedResponse) .Setup(response => response.GetEnumerator()) .Returns(documents.GetEnumerator()); observerContext = Mock.Of <IChangeFeedObserverContext>(); Mock.Get(observerContext) .Setup(context => context.CheckpointAsync()) .Returns(partitionCheckpointer.CheckpointPartitionAsync("token")); }
public PartitionProcessor(IChangeFeedObserver observer, IChangeFeedDocumentQuery <Document> query, ChangeFeedOptions options, ProcessorSettings settings, IPartitionCheckpointer checkpointer) { this.observer = observer; this.settings = settings; this.checkpointer = checkpointer; this.options = options; this.query = query; }
public PartitionProcessor(IChangeFeedObserver observer, IChangeFeedDocumentClient documentClient, ProcessorSettings settings, IPartitionCheckpointer checkpointer) { this.observer = observer; this.settings = settings; this.checkpointer = checkpointer; this.options = new ChangeFeedOptions { MaxItemCount = settings.MaxItemCount, PartitionKeyRangeId = settings.PartitionKeyRangeId, SessionToken = settings.SessionToken, StartFromBeginning = settings.StartFromBeginning, RequestContinuation = settings.RequestContinuation, StartTime = settings.StartTime, }; this.query = documentClient.CreateDocumentChangeFeedQuery(settings.CollectionSelfLink, this.options); }
internal ChangeFeedObserverContext(string partitionId, IFeedResponse <Document> feedResponse, IPartitionCheckpointer checkpointer) { this.PartitionKeyRangeId = partitionId; this.FeedResponse = feedResponse; this.checkpointer = checkpointer; }