Interface PagePublisher<T>
-
- Type Parameters:
T
- The modelled type of the object in a page.
- All Superinterfaces:
org.reactivestreams.Publisher<Page<T>>
,SdkPublisher<Page<T>>
@ThreadSafe public interface PagePublisher<T> extends SdkPublisher<Page<T>>
Represents the result from paginated operations such as scan and query.You can either subscribe to the
Page
s or flattened items across all pages viaitems()
. Example:1) Subscribing to
Page
sPagePublisher<MyItem> publisher = mappedTable.scan(); publisher.subscribe(page -> page.items().forEach(item -> System.out.println(item))) .exceptionally(failure -> { failure.printStackTrace(); return null; });
2) Subscribing to items across all pages.
PagePublisher<MyItem> publisher = mappedTable.scan(); publisher.items() .subscribe(item -> System.out.println(item)) .exceptionally(failure -> { failure.printStackTrace(); return null; });
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description static <T> PagePublisher<T>
create(SdkPublisher<Page<T>> publisher)
Creates a flattened items publisher with the underlying page publisher.default SdkPublisher<T>
items()
Returns a publisher that can be used to request a stream of items across all pages.-
Methods inherited from interface software.amazon.awssdk.core.async.SdkPublisher
addTrailingData, buffer, doAfterOnCancel, doAfterOnComplete, doAfterOnError, filter, filter, flatMapIterable, limit, map, subscribe
-
-
-
-
Method Detail
-
create
static <T> PagePublisher<T> create(SdkPublisher<Page<T>> publisher)
Creates a flattened items publisher with the underlying page publisher.
-
items
default SdkPublisher<T> items()
Returns a publisher that can be used to request a stream of items across all pages.This method is useful if you are interested in subscribing the items in the response pages instead of the top level pages.
-
-