I am using DynamoDBEnchancedAsyncClient to query DynamoDB using GSI and pagination. Below is the code that I am using to achieve the same. I am tying to limit the number of items per page and number of pages sent to the subscriber of the Flux
DynamoDBAsyncIndex<Customer> secindex= dynamodbasyncenhancedclient.table(Customer, Customer_Schema).index(GSI_INDEX_NAME)
SdkPublisher<Page<Customer>> query = secindex.query(QueryEnhancedRequest.builder().queryConditional(queryconditional)).limit(2).build()
Flux.from(PagePublisher.create(query).items().limit(5))
Few observations that I made are
The limit(2) in the QueryEnhancedRequest limits the number of items per page to 2. I checked it by subscribing to the SDKPublisher.
However I want to limit the pages that are sent to the subscriber of the Flux above , but
limit(5)is not giving the desired result. Is there any way to limit the number of pages that are emitted from the aboveflux?Is there any way to limit the number of pages that are fetched from the
DDBfor a particular query request?