Beispiel #1
0
        public override FeedProcessor Create(DocumentServiceLease lease, ChangeFeedObserver <T> observer)
        {
            if (observer == null)
            {
                throw new ArgumentNullException(nameof(observer));
            }
            if (lease == null)
            {
                throw new ArgumentNullException(nameof(lease));
            }

            ProcessorOptions options = new ProcessorOptions
            {
                StartContinuation = !string.IsNullOrEmpty(lease.ContinuationToken) ?
                                    lease.ContinuationToken :
                                    this.changeFeedProcessorOptions.StartContinuation,
                LeaseToken         = lease.CurrentLeaseToken,
                FeedPollDelay      = this.changeFeedProcessorOptions.FeedPollDelay,
                MaxItemCount       = this.changeFeedProcessorOptions.MaxItemCount,
                StartFromBeginning = this.changeFeedProcessorOptions.StartFromBeginning,
                StartTime          = this.changeFeedProcessorOptions.StartTime,
                SessionToken       = this.changeFeedProcessorOptions.SessionToken,
            };

            PartitionCheckpointerCore checkpointer = new PartitionCheckpointerCore(this.leaseCheckpointer, lease);
            ChangeFeedPartitionKeyResultSetIteratorCore iterator = ChangeFeedPartitionKeyResultSetIteratorCore.Create(
                lease: lease,
                continuationToken: options.StartContinuation,
                maxItemCount: options.MaxItemCount,
                container: this.container,
                startTime: options.StartTime,
                startFromBeginning: options.StartFromBeginning);

            return(new FeedProcessorCore <T>(observer, iterator, options, checkpointer, this.serializerCore));
        }
        public override FeedProcessor Create(DocumentServiceLease lease, ChangeFeedObserver <T> observer)
        {
            if (observer == null)
            {
                throw new ArgumentNullException(nameof(observer));
            }
            if (lease == null)
            {
                throw new ArgumentNullException(nameof(lease));
            }

            var settings = new ProcessorSettings
            {
                StartContinuation = !string.IsNullOrEmpty(lease.ContinuationToken) ?
                                    lease.ContinuationToken :
                                    this.changeFeedProcessorOptions.StartContinuation,
                LeaseToken         = lease.CurrentLeaseToken,
                FeedPollDelay      = this.changeFeedProcessorOptions.FeedPollDelay,
                MaxItemCount       = this.changeFeedProcessorOptions.MaxItemCount,
                StartFromBeginning = this.changeFeedProcessorOptions.StartFromBeginning,
                StartTime          = this.changeFeedProcessorOptions.StartTime,
                SessionToken       = this.changeFeedProcessorOptions.SessionToken,
            };

            var checkpointer = new PartitionCheckpointerCore(this.leaseCheckpointer, lease);

            return(new FeedProcessorCore <T>(observer, this.container, settings, checkpointer));
        }