Ejemplo n.º 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 FeedProcessorCore(
     ChangeFeedObserver observer,
     FeedIterator resultSetIterator,
     ProcessorOptions options,
     PartitionCheckpointer checkpointer)
 {
     this.observer          = observer ?? throw new ArgumentNullException(nameof(observer));
     this.options           = options ?? throw new ArgumentNullException(nameof(options));
     this.checkpointer      = checkpointer ?? throw new ArgumentNullException(nameof(checkpointer));
     this.resultSetIterator = resultSetIterator ?? throw new ArgumentNullException(nameof(resultSetIterator));
 }
 public FeedProcessorCore(
     ChangeFeedObserver <T> observer,
     FeedIterator resultSetIterator,
     ProcessorOptions options,
     PartitionCheckpointer checkpointer,
     CosmosSerializer cosmosJsonSerializer)
 {
     this.observer             = observer;
     this.options              = options;
     this.checkpointer         = checkpointer;
     this.resultSetIterator    = resultSetIterator;
     this.cosmosJsonSerializer = cosmosJsonSerializer;
 }