Hi,

Actually you are doing nothing wrong here. Apparently when you set
maxResultsPerPage, in Azure client, that means it will return pageable
list, now in every pagelist it will return the max blobs that you set
earlier in `maxResultsPerPage` which is IMO pretty weird from Azure's side.
Now in the Camel component side, we just collect all that list of blobs in
the pages into one list and return that in the body and hence the reason
why you see no effects. I hope Azure will improve the API in the future to
allow alternative options as max results regardless of the pageable list.

Regards,
Omar

On Mon, Jan 25, 2021 at 8:04 PM Mark Andreev <mark.andr...@gmail.com> wrote:

> Hi, I use Spring 2.4.2 with camel-azure-storage-blob 3.7.0.
>
> When I set BlobConstants.LIST_BLOB_OPTIONS as "new
> ListBlobsOptions().setMaxResultsPerPage(5)" driver returns all entities
> from blob.
>
> from("direct:list")
> .routeId("listBlobs")
> .setHeader(BlobConstants.LIST_BLOB_OPTIONS)
>
> .constant(new ListBlobsOptions().setMaxResultsPerPage(5))
> .to(
> String.format(
> "
>
> azure-storage-blob://%s/%s?accessKey=RAW(%s)&operation=listBlobs&synchronous=true
> ",
> ACCOUNT,
> BLOB_CONTAINER_NAME,
> ACCESS_KEY
> )
> )
> .process(exchange -> {
> int itemsCount = exchange.getIn().getBody(List.class).size();
> log.info(String.format("Items count = '%d'", itemsCount));
> });
>
> How should I use this API to fetch only 5 items?
>
> Full example:
>
> https://github.com/mrk-andreev/example-camel-azure-blob-pagination-bug/blob/master/src/main/java/name/mrkandreev/camel/MyApplication.java
> --
> Best regards,
> Mark Andreev
>

Reply via email to