/// <summary>
        /// Returns <see cref="BlobChangeFeedEvent"/>s as Pages.
        /// </summary>
        /// <param name="continuationToken">
        /// Throws an <see cref="ArgumentException"/>.  To use contination, call
        /// <see cref="BlobChangeFeedClient.GetChanges(string)"/>.
        /// </param>
        /// <param name="pageSizeHint">
        /// Page size.
        /// </param>
        /// <returns>
        /// <see cref="IEnumerable{Page}"/>.
        /// </returns>
        public override IEnumerable <Page <BlobChangeFeedEvent> > AsPages(string continuationToken = null, int?pageSizeHint = null)
        {
            if (continuationToken != null)
            {
                throw new ArgumentException($"Continuation not supported.  Use BlobChangeFeedClient.GetChanges(string) instead");
            }

            ChangeFeed changeFeed = _changeFeedFactory.BuildChangeFeed(
                async: false,
                _startTime,
                _endTime,
                _continuation)
                                    .EnsureCompleted();

            while (changeFeed.HasNext())
            {
                yield return(changeFeed.GetPage(
                                 async: false,
                                 pageSize: pageSizeHint ?? 512).EnsureCompleted());
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Returns <see cref="BlobChangeFeedEvent"/>s as Pages.
        /// </summary>
        /// <param name="continuationToken">
        /// Throws an <see cref="ArgumentException"/>.  To use contination, call
        /// <see cref="BlobChangeFeedClient.GetChangesAsync(string)"/>.
        /// </param>
        /// <param name="pageSizeHint">
        /// Page size.
        /// </param>
        /// <returns>
        /// <see cref="IAsyncEnumerable{Page}"/>.
        /// </returns>
        public override async IAsyncEnumerable <Page <BlobChangeFeedEvent> > AsPages(
            string continuationToken = null,
            int?pageSizeHint         = null)
        {
            if (continuationToken != null)
            {
                throw new ArgumentException($"{nameof(continuationToken)} not supported.  Use BlobChangeFeedClient.GetChangesAsync(string) instead");
            }

            ChangeFeed changeFeed = await _changeFeedFactory.BuildChangeFeed(
                _startTime,
                _endTime,
                _continuation,
                async : true,
                cancellationToken : default)
                                    .ConfigureAwait(false);

            while (changeFeed.HasNext())
            {
                yield return(await changeFeed.GetPage(
                                 async : true,
                                 pageSize : pageSizeHint ?? Constants.ChangeFeed.DefaultPageSize).ConfigureAwait(false));
            }
        }