### YamlMime:JavaType uid: "com.azure.core.http.rest.PagedFlux" fullName: "com.azure.core.http.rest.PagedFlux" name: "PagedFlux" nameWithType: "PagedFlux" summary: "PagedFlux is a Flux that provides the ability to operate on paginated REST responses of type and individual items in such pages." inheritances: - "" - "" - "" - "" - "" inheritedClassMethods: - classRef: "" methodsRef: - "" - "" - ")?alt=com.azure.core.http.rest.PagedFluxBase.subscribe&text=subscribe\" data-throw-if-not-resolved=\"False\" />" - classRef: "" methodsRef: - "" - classRef: "" methodsRef: - "" - "" - "" - "" - classRef: "java.lang.Object" methodsRef: - "clone" - "equals" - "finalize" - "getClass" - "hashCode" - "notify" - "notifyAll" - "wait" - "wait" - "wait" - classRef: "reactor.core.publisher.Flux" methodsRef: - "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" - "-int-int-\">mergeSequential" - "mergeSequential" - "mergeSequentialDelayError" - "-int-int-\">mergeSequentialDelayError" - "collectMap" - "-\">collectMap" - "collectMultimap" - ">-\">collectMultimap" - "groupBy" - "groupBy" - "collectMap" - "collectMultimap" - "groupBy" - "groupBy" - "error" - "-int-java.util.function.Function-\">zip" - "-java.util.function.Function-\">zip" - "-\">as" - "collect" - "-\">concatMapIterable" - "-int-\">concatMapIterable" - "doOnDiscard" - "-\">flatMap" - "-java.util.function.Function>-java.util.function.Supplier>-\">flatMap" - "-\">flatMapIterable" - "-int-\">flatMapIterable" - "-\">flatMapSequential" - "-int-\">flatMapSequential" - "-int-int-\">flatMapSequential" - "-int-int-\">flatMapSequentialDelayError" - "-\">handle" - "-\">publish" - "-int-\">publish" - "-java.util.function.Consumer-\">using" - "-java.util.function.Consumer-boolean-\">using" - "-java.util.function.Function>-\">usingWhen" - "-java.util.function.Function>-java.util.function.BiFunction>-java.util.function.Function>-\">usingWhen" - "-\">generate" - "-java.util.function.Consumer-\">generate" - "-int-java.util.function.Function-\">combineLatest" - "-java.util.function.Function-\">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" - "-int-\">concat" - "concatDelayError" - "-\">concatDelayError" - "-boolean-int-\">concatDelayError" - "-int-\">concatDelayError" - "-\">create" - "-reactor.core.publisher.FluxSink.OverflowStrategy-\">create" - "-\">defer" - "-\">deferContextual" - "-\">deferWithContext" - "empty" - "error" - "error" - "from" - "fromArray" - "fromIterable" - "-\">fromStream" - "fromStream" - "-\">generate" - "just" - "just" - "-\">merge" - "-int-\">merge" - "-int-int-\">merge" - "mergeComparing" - "mergeComparing" - "mergeComparingDelayError" - "mergeOrdered" - "mergeOrdered" - "mergePriority" - "mergePriority" - "mergePriorityDelayError" - "-\">mergeSequential" - "-int-int-\">mergeSequential" - "-int-int-\">mergeSequentialDelayError" - "never" - "onAssembly" - "onAssembly" - "-\">push" - "-reactor.core.publisher.FluxSink.OverflowStrategy-\">push" - "-\">switchOnNext" - "-int-\">switchOnNext" - "-java.util.function.Function>-java.util.function.BiFunction-? extends R>-\">groupJoin" - "-java.util.function.Function>-java.util.function.BiFunction-\">join" - "-java.util.function.Function-\">zip" - "withLatestFrom" - "-java.util.function.Supplier-\">bufferWhen" - "-\">bufferWhen" - "-\">timeout" - "-org.reactivestreams.Publisher-\">timeout" - "-\">windowWhen" - "delaySubscription" - "ofType" - "sample" - "-\">sampleFirst" - "-\">sampleTimeout" - "-int-\">sampleTimeout" - "timeout" - "distinct" - "distinct" - "bufferUntilChanged" - "bufferUntilChanged" - "bufferUntilChanged" - "-\">concatMap" - "-int-\">concatMap" - "-\">concatMapDelayError" - "-boolean-int-\">concatMapDelayError" - "-int-\">concatMapDelayError" - "distinct" - "distinctUntilChanged" - "distinctUntilChanged" - "-int-\">flatMap" - "-int-int-\">flatMap" - "-int-int-\">flatMapDelayError" - "map" - "mapNotNull" - "-\">switchMap" - "-int-\">switchMap" - "-\">switchOnFirst" - "-boolean-\">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" - "-int-\">expand" - "-\">expandDeep" - "-int-\">expandDeep" - "filter" - "-\">filterWhen" - "-int-\">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" - "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" syntax: "public class **PagedFlux**
extends <,<>>" constructors: - uid: "com.azure.core.http.rest.PagedFlux.PagedFlux(java.util.function.Function>>)" fullName: "com.azure.core.http.rest.PagedFlux.PagedFlux(Function>> firstPageRetriever)" name: "PagedFlux(Function>> firstPageRetriever)" nameWithType: "PagedFlux.PagedFlux(Function>> firstPageRetriever)" summary: "Creates an instance of that consists of only a single page with a given element count." parameters: - description: "Function that retrieves the first page." name: "firstPageRetriever" type: "Function<Integer,Mono<<>>>" syntax: "public PagedFlux(Function>> firstPageRetriever)" desc: "Creates an instance of that consists of only a single page with a given element count.\n\n**Code sample**\n\n```java\n// A function that fetches the single page of data from a source/service.\n Function>> singlePageRetriever = pageSize ->\n getFirstPageWithSize(pageSize);\n\n PagedFlux singlePageFluxWithPageSize = new PagedFlux(singlePageRetriever);\n```" - uid: "com.azure.core.http.rest.PagedFlux.PagedFlux(java.util.function.Function>>,java.util.function.BiFunction>>)" fullName: "com.azure.core.http.rest.PagedFlux.PagedFlux(Function>> firstPageRetriever, BiFunction>> nextPageRetriever)" name: "PagedFlux(Function>> firstPageRetriever, BiFunction>> nextPageRetriever)" nameWithType: "PagedFlux.PagedFlux(Function>> firstPageRetriever, BiFunction>> nextPageRetriever)" summary: "Creates an instance of that is capable of retrieving multiple pages with of a given page size." parameters: - description: "Function that retrieves the first page." name: "firstPageRetriever" type: "Function<Integer,Mono<<>>>" - description: "BiFunction that retrieves the next page given a continuation token and page size." name: "nextPageRetriever" type: "BiFunction<String,Integer,Mono<<>>>" syntax: "public PagedFlux(Function>> firstPageRetriever, BiFunction>> nextPageRetriever)" desc: "Creates an instance of that is capable of retrieving multiple pages with of a given page size.\n\n**Code sample**\n\n```java\n// A function that fetches the first page of data from a source/service.\n Function>> firstPageRetriever = pageSize -> getFirstPageWithSize(pageSize);\n\n // A function that fetches subsequent pages of data from a source/service given a continuation token.\n BiFunction>> nextPageRetriever = (continuationToken, pageSize) ->\n getNextPageWithSize(continuationToken, pageSize);\n\n PagedFlux pagedFluxWithPageSize = new PagedFlux<>(firstPageRetriever, nextPageRetriever);\n```" - uid: "com.azure.core.http.rest.PagedFlux.PagedFlux(java.util.function.Supplier>>)" fullName: "com.azure.core.http.rest.PagedFlux.PagedFlux(Supplier>> firstPageRetriever)" name: "PagedFlux(Supplier>> firstPageRetriever)" nameWithType: "PagedFlux.PagedFlux(Supplier>> firstPageRetriever)" summary: "Creates an instance of that consists of only a single page." parameters: - description: "Supplier that retrieves the first page." name: "firstPageRetriever" type: "Supplier<Mono<<>>>" syntax: "public PagedFlux(Supplier>> firstPageRetriever)" desc: "Creates an instance of that consists of only a single page. This constructor takes a `Supplier` that return the single page of `T`.\n\n**Code sample**\n\n```java\n// A supplier that fetches the first page of data from source/service\n Supplier>> firstPageRetrieverFunction = () -> getFirstPage();\n\n PagedFlux pagedFluxInstance = new PagedFlux<>(firstPageRetrieverFunction,\n nextPageRetriever);\n```" - uid: "com.azure.core.http.rest.PagedFlux.PagedFlux(java.util.function.Supplier>>,java.util.function.Function>>)" fullName: "com.azure.core.http.rest.PagedFlux.PagedFlux(Supplier>> firstPageRetriever, Function>> nextPageRetriever)" name: "PagedFlux(Supplier>> firstPageRetriever, Function>> nextPageRetriever)" nameWithType: "PagedFlux.PagedFlux(Supplier>> firstPageRetriever, Function>> nextPageRetriever)" summary: "Creates an instance of ." parameters: - description: "Supplier that retrieves the first page" name: "firstPageRetriever" type: "Supplier<Mono<<>>>" - description: "Function that retrieves the next page given a continuation token" name: "nextPageRetriever" type: "Function<String,Mono<<>>>" syntax: "public PagedFlux(Supplier>> firstPageRetriever, Function>> nextPageRetriever)" desc: "Creates an instance of . The constructor takes a `Supplier` and `Function`. The `Supplier` returns the first page of `T`, the `Function` retrieves subsequent pages of `T`.\n\n**Code sample**\n\n```java\n// A supplier that fetches the first page of data from source/service\n Supplier>> firstPageRetriever = () -> getFirstPage();\n\n // A function that fetches subsequent pages of data from source/service given a continuation token\n Function>> nextPageRetriever =\n continuationToken -> getNextPage(continuationToken);\n\n PagedFlux pagedFlux = new PagedFlux<>(firstPageRetriever,\n nextPageRetriever);\n```" methods: - uid: "com.azure.core.http.rest.PagedFlux.mapPage(java.util.function.Function)" fullName: "com.azure.core.http.rest.PagedFlux.mapPage(Function mapper)" name: "mapPage(Function mapper)" nameWithType: "PagedFlux.mapPage(Function mapper)" summary: "Maps this PagedFlux instance of T to a PagedFlux instance of type S as per the provided mapper function." deprecatedTag: "refer the decoration samples for ." parameters: - description: "The mapper function to convert from type T to type S." name: "mapper" type: "Function<,>" syntax: "@Deprecated
public PagedFlux mapPage(Function mapper)" desc: "Maps this PagedFlux instance of T to a PagedFlux instance of type S as per the provided mapper function." hasDeprecatedTag: true returns: description: "A PagedFlux of type S." type: "<>" - uid: "com.azure.core.http.rest.PagedFlux.create(java.util.function.Supplier>>)" fullName: "com.azure.core.http.rest.PagedFlux.create(Supplier>> provider)" name: "create(Supplier>> provider)" nameWithType: "PagedFlux.create(Supplier>> provider)" summary: "Creates an instance of backed by a Page Retriever Supplier (provider)." modifiers: - "static" parameters: - description: "the Page Retrieval Provider" name: "provider" type: "Supplier<<String,<>>>" syntax: "public static PagedFlux create(Supplier>> provider)" desc: "Creates an instance of backed by a Page Retriever Supplier (provider). When invoked provider should return . The provider will be called for each Subscription to the PagedFlux instance. The Page Retriever can get called multiple times in serial fashion, each time after the completion of the Flux returned from the previous invocation. The final completion signal will be send to the Subscriber when the last Page emitted by the Flux returned by Page Retriever has `null` continuation token. The provider is useful mainly in two scenarios:\n\n * To manage state across multiple call to Page Retrieval within the same Subscription.\n * To decorate a PagedFlux to produce new PagedFlux.\n\n**Decoration sample**\n\n```java\n// Transform a PagedFlux with Integer items to PagedFlux of String items.\n final PagedFlux intPagedFlux = createAnInstance();\n\n // PagedResponse to PagedResponse mapper\n final Function, PagedResponse> responseMapper\n = intResponse -> new PagedResponseBase(intResponse.getRequest(),\n intResponse.getStatusCode(),\n intResponse.getHeaders(),\n intResponse.getValue()\n .stream()\n .map(intValue -> Integer.toString(intValue)).collect(Collectors.toList()),\n intResponse.getContinuationToken(),\n null);\n\n final Supplier>> provider = () ->\n (continuationToken, pageSize) -> {\n Flux> flux = (continuationToken == null)\n ? intPagedFlux.byPage()\n : intPagedFlux.byPage(continuationToken);\n return flux.map(responseMapper);\n };\n PagedFlux strPagedFlux = PagedFlux.create(provider);\n\n // Create a PagedFlux from a PagedFlux with all exceptions mapped to a specific exception.\n final PagedFlux pagedFlux = createAnInstance();\n final Supplier>> eprovider = () ->\n (continuationToken, pageSize) -> {\n Flux> flux = (continuationToken == null)\n ? pagedFlux.byPage()\n : pagedFlux.byPage(continuationToken);\n return flux.onErrorMap(Exception.class, PaginationException::new);\n };\n final PagedFlux exceptionMappedPagedFlux = PagedFlux.create(eprovider);\n```" returns: description: "PagedFlux backed by the Page Retriever Function Supplier" type: "<>" type: "class" typeParameters: - description: "The type of items in a " name: "T" desc: "PagedFlux is a Flux that provides the ability to operate on paginated REST responses of type and individual items in such pages. When processing the response by page each response will contain the items in the page as well as the REST response details such as status code and headers.\n\nTo process one item at a time, simply subscribe to this flux as shown below\n\n**Code sample**\n\n```java\n// Subscribe to process one item at a time\n pagedFlux\n .log()\n .subscribe(item -> System.out.println(\"Processing item with value: \" + item),\n error -> System.err.println(\"An error occurred: \" + error),\n () -> System.out.println(\"Processing complete.\"));\n```\n\nTo process one page at a time, use method as shown below\n\n**Code sample**\n\n```java\n// Subscribe to process one page at a time from the beginning\n pagedFlux\n .byPage()\n .log()\n .subscribe(page -> System.out.printf(\"Processing page containing item values: %s%n\",\n page.getElements().stream().map(String::valueOf).collect(Collectors.joining(\", \"))),\n error -> System.err.println(\"An error occurred: \" + error),\n () -> System.out.println(\"Processing complete.\"));\n```\n\nTo process items one page at a time starting from any page associated with a continuation token, use as shown below\n\n**Code sample**\n\n```java\n// Subscribe to process one page at a time starting from a page associated with\n // a continuation token\n String continuationToken = getContinuationToken();\n pagedFlux\n .byPage(continuationToken)\n .log()\n .doOnSubscribe(ignored -> System.out.println(\n \"Subscribed to paged flux processing pages starting from: \" + continuationToken))\n .subscribe(page -> System.out.printf(\"Processing page containing item values: %s%n\",\n page.getElements().stream().map(String::valueOf).collect(Collectors.joining(\", \"))),\n error -> System.err.println(\"An error occurred: \" + error),\n () -> System.out.println(\"Processing complete.\"));\n```" metadata: {} package: "com.azure.core.http.rest" artifact: com.azure:azure-core:1.52.0