Exemple #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));
        }
 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;
 }
        public AutoCheckpointer(CheckpointFrequency checkpointFrequency, ChangeFeedObserver <T> observer)
        {
            if (checkpointFrequency == null)
            {
                throw new ArgumentNullException(nameof(checkpointFrequency));
            }
            if (observer == null)
            {
                throw new ArgumentNullException(nameof(observer));
            }

            this.checkpointFrequency = checkpointFrequency;
            this.observer            = observer;
        }
        public FeedProcessorCore(ChangeFeedObserver <T> observer, CosmosContainer container, ProcessorSettings settings, PartitionCheckpointer checkpointer)
        {
            this.observer     = observer;
            this.settings     = settings;
            this.checkpointer = checkpointer;
            this.options      = new ChangeFeedOptions
            {
                MaxItemCount        = settings.MaxItemCount,
                PartitionKeyRangeId = settings.LeaseToken,
                SessionToken        = settings.SessionToken,
                StartFromBeginning  = settings.StartFromBeginning,
                RequestContinuation = settings.StartContinuation,
                StartTime           = settings.StartTime,
            };

            this.query = container.Client.DocumentClient.CreateDocumentChangeFeedQuery(container.LinkUri.ToString(), this.options);
        }
Exemple #7
0
 public ObserverExceptionWrappingChangeFeedObserverDecorator(ChangeFeedObserver <T> changeFeedObserver)
 {
     this.changeFeedObserver = changeFeedObserver;
 }
 /// <summary>
 /// Creates an instance of a <see cref="FeedProcessor"/>.
 /// </summary>
 /// <param name="lease">Lease to be used for feed processing</param>
 /// <param name="observer">Observer to be used</param>
 /// <returns>An instance of a <see cref="FeedProcessor"/>.</returns>
 public abstract FeedProcessor Create(DocumentServiceLease lease, ChangeFeedObserver <T> observer);