Share via


CosmosPagedFlux<T> Class

Type Parameters

T

The type of elements in a ContinuablePage<C,T>

public class CosmosPagedFlux
extends ContinuablePagedFlux<String,T,FeedResponse<T>>

Cosmos implementation of ContinuablePagedFlux<C,T,P>.

This type is a Flux that provides the ability to operate on pages of type FeedResponse<T> and individual items in such pages. This type supports String type continuation tokens, allowing for restarting from a previously-retrieved continuation token.

For more information on the base type, refer ContinuablePagedFlux<C,T,P>

Method Summary

Modifier and Type Method and Description
Flux<FeedResponse<T>> byPage()

Gets a Flux of FeedResponse<T> starting at the first page.

Flux<FeedResponse<T>> byPage(int preferredPageSize)

Gets a Flux of FeedResponse<T> starting at the first page requesting each page to contain a number of elements equal to the preferred page size.

Flux<FeedResponse<T>> byPage(String continuationToken)

Gets a Flux of FeedResponse<T> beginning at the page identified by the given continuation token.

Flux<FeedResponse<T>> byPage(String continuationToken, int preferredPageSize)

Gets a Flux of FeedResponse<T> beginning at the page identified by the given continuation token requesting each page to contain the number of elements equal to the preferred page size.

static CosmosPagedFlux<T> fromList(List<T> items, boolean isChangeFeed)

Creates an instance of a CosmosPagedFlux for mocking purposes or when injecting CosmosPagedFlux instances from a different data source

CosmosPagedFlux<T> handle(Consumer<FeedResponse<T>> newFeedResponseConsumer)

Handle for invoking "side-effects" on each FeedResponse returned by CosmosPagedFlux

void subscribe(CoreSubscriber<? super T> coreSubscriber)

Subscribe to consume all items of type T in the sequence respectively.

Methods inherited from ContinuablePagedFlux

Methods inherited from java.lang.Object

Methods inherited from reactor.core.publisher.Flux

reduce reduceWith scan scanWith buffer buffer buffer bufferTimeout bufferTimeout cast collect doOnError onErrorContinue onErrorContinue onErrorMap onErrorResume onErrorReturn subscribeWith zip zip first first firstWithSignal firstWithSignal firstWithValue firstWithValue index merge merge merge mergeComparing mergeDelayError mergeOrdered mergePriority mergeSequential mergeSequential mergeSequential mergeSequential mergeSequentialDelayError mergeSequentialDelayError collectMap collectMap collectMultimap collectMultimap groupBy groupBy collectMap collectMultimap groupBy groupBy error zip zip as collect concatMapIterable concatMapIterable doOnDiscard flatMap flatMap flatMapIterable flatMapIterable flatMapSequential flatMapSequential flatMapSequential flatMapSequentialDelayError handle publish publish using using usingWhen usingWhen generate generate combineLatest combineLatest combineLatest combineLatest zip zip zip combineLatest zip combineLatest zip combineLatest zip combineLatest zip combineLatest zip zipWith zipWith zipWithIterable zipWith zipWith zipWithIterable concat concat concat concat concatDelayError concatDelayError concatDelayError concatDelayError create create defer deferContextual deferWithContext empty error error from fromArray fromIterable fromStream fromStream generate just just merge merge merge mergeComparing mergeComparing mergeComparingDelayError mergeOrdered mergeOrdered mergePriority mergePriority mergePriorityDelayError mergeSequential mergeSequential mergeSequentialDelayError never onAssembly onAssembly push push switchOnNext switchOnNext groupJoin join zip withLatestFrom bufferWhen bufferWhen timeout timeout windowWhen delaySubscription ofType sample sampleFirst sampleTimeout sampleTimeout timeout distinct distinct bufferUntilChanged bufferUntilChanged bufferUntilChanged concatMap concatMap concatMapDelayError concatMapDelayError concatMapDelayError distinct distinctUntilChanged distinctUntilChanged flatMap flatMap flatMapDelayError map mapNotNull switchMap switchMap switchOnFirst switchOnFirst then thenMany transform transformDeferred transformDeferredContextual windowUntilChanged windowUntilChanged windowUntilChanged dematerialize all any blockFirst blockFirst blockLast blockLast buffer buffer buffer buffer buffer buffer buffer buffer bufferTimeout bufferTimeout bufferUntil bufferUntil bufferWhile cache cache cache cache cache cache cancelOn checkpoint checkpoint checkpoint collectList collectSortedList collectSortedList concatWith concatWithValues contextWrite contextWrite count defaultIfEmpty delayElements delayElements delaySequence delaySequence delaySubscription delaySubscription delayUntil distinct distinctUntilChanged doAfterTerminate doFinally doFirst doOnCancel doOnComplete doOnEach doOnError doOnError doOnNext doOnRequest doOnSubscribe doOnTerminate elapsed elapsed elementAt elementAt expand expand expandDeep expandDeep filter filterWhen filterWhen getPrefetch hasElement hasElements hide ignoreElements index interval interval interval interval last last limitRate limitRate limitRequest log log log log log log materialize mergeComparingWith mergeOrderedWith mergeWith metrics name next onBackpressureBuffer onBackpressureBuffer onBackpressureBuffer onBackpressureBuffer onBackpressureBuffer onBackpressureBuffer onBackpressureBuffer onBackpressureDrop onBackpressureDrop onBackpressureError onBackpressureLatest onErrorComplete onErrorComplete onErrorComplete onErrorContinue onErrorMap onErrorMap onErrorResume onErrorResume onErrorReturn onErrorReturn onErrorStop onTerminateDetach or parallel parallel parallel publish publish publishNext publishOn publishOn publishOn range reduce repeat repeat repeat repeat repeatWhen replay replay replay replay replay replay retry retry retryWhen sample sampleFirst scan share shareNext single single singleOrEmpty skip skip skip skipLast skipUntil skipUntilOther skipWhile sort sort startWith startWith startWith subscribe subscribe subscribe subscribe subscribe subscribe subscribe subscribe subscribeOn subscribeOn subscriberContext subscriberContext switchIfEmpty tag take take take take takeLast takeUntil takeUntilOther takeWhile then thenEmpty timed timed timeout timeout timeout timeout timestamp timestamp toIterable toIterable toIterable toStream toStream toString window window window window window window window windowTimeout windowTimeout windowTimeout windowTimeout windowUntil windowUntil windowUntil windowWhile windowWhile

Method Details

byPage

public Flux> byPage()

Gets a Flux of FeedResponse<T> starting at the first page.

Overrides:

CosmosPagedFlux<T>.byPage()

Returns:

A Flux of FeedResponse<T>.

byPage

public Flux> byPage(int preferredPageSize)

Gets a Flux of FeedResponse<T> starting at the first page requesting each page to contain a number of elements equal to the preferred page size.

The service may or may not honor the preferred page size therefore the client MUST be prepared to handle pages with different page sizes.

Overrides:

CosmosPagedFlux<T>.byPage(int preferredPageSize)

Parameters:

preferredPageSize - The preferred page size.

Returns:

A Flux of FeedResponse<T>.

byPage

public Flux> byPage(String continuationToken)

Gets a Flux of FeedResponse<T> beginning at the page identified by the given continuation token.

Overrides:

CosmosPagedFlux<T>.byPage(String continuationToken)

Parameters:

continuationToken - A continuation token identifying the page to select.

Returns:

A Flux of FeedResponse<T>.

byPage

public Flux> byPage(String continuationToken, int preferredPageSize)

Gets a Flux of FeedResponse<T> beginning at the page identified by the given continuation token requesting each page to contain the number of elements equal to the preferred page size.

The service may or may not honor the preferred page size therefore the client MUST be prepared to handle pages with different page sizes.

Overrides:

CosmosPagedFlux<T>.byPage(String continuationToken, int preferredPageSize)

Parameters:

continuationToken - A continuation token identifying the page to select.
preferredPageSize - The preferred page size.

Returns:

A Flux of FeedResponse<T>.

fromList

public static CosmosPagedFlux fromList(List items, boolean isChangeFeed)

Creates an instance of a CosmosPagedFlux for mocking purposes or when injecting CosmosPagedFlux instances from a different data source

Parameters:

items -
  • the list of items to be returned
isChangeFeed -
  • a flag indicating whether the CosmosPagedFlux will be returned from a change feed API

Returns:

an instance of CosmosPagedFlux

handle

public CosmosPagedFlux handle(Consumer> newFeedResponseConsumer)

Handle for invoking "side-effects" on each FeedResponse returned by CosmosPagedFlux

Parameters:

newFeedResponseConsumer - handler

Returns:

CosmosPagedFlux instance with attached handler

subscribe

public void subscribe(CoreSubscriber coreSubscriber)

Subscribe to consume all items of type T in the sequence respectively. This is recommended for most common scenarios. This will seamlessly fetch next page when required and provide with a Flux of items.

Overrides:

CosmosPagedFlux<T>.subscribe(CoreSubscriber<? super T> coreSubscriber)

Parameters:

coreSubscriber - The subscriber for this CosmosPagedFlux<T>

Applies to