question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Simpler Data Methods

See original GitHub issue

“I feel like Flux<ByteBuffer> is an advanced use case, in the already-advanced async world. I wonder if there should be additional API here that takes either ByteBuffer directly, or simply an OutputStream similar to the sync case.”

Look into adding OutputStream methods that correspond to the Flux<ByteBuffer> methods in the async clients. Update the sync methods to pass through their OutputStream to the async method.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
connieycommented, Sep 30, 2019

In my opinion, the download() return value (ie. Mono<Flux<ByteBuffer>>) isn’t intuitive. When you tell the BlobAsyncClient you want to download an item, I expect it to return a stream of bytes for me to do whatever with.

Instead it returns a Mono that could either complete with an error, nothing, or a stream of bytes that I then have to unwrap to consume. The same set of scenarios can be accomplished with: Flux<ByteBuffer>.

Working with this API during the storage scavenger hunt was cumbersome because I had to use a .flatMap to toss out the Mono before being able to consume the byte buffer.

With Mono<Flux<ByteBuffer>>

private static Mono<Void> handleDownload(Mono<Flux<ByteBuffer>> contents) {
    return contents
            .flatMap(buffer -> buffer.reduce(ByteBuffer.allocate(0), App::concat))
            .map(concatenate -> {
                final CharBuffer decode = StandardCharsets.UTF_8.decode(concatenate);
                System.out.printf("Item: %s%n%n", decode);
                return decode;
            }).then();
}

With Flux<ByteBuffer>

private static Mono<Void> handleDownload(Flux<ByteBuffer> contents) {
    return contents
            .reduce(ByteBuffer.allocate(0), App::concat)
            .map(concatenate -> {
                final CharBuffer decode = StandardCharsets.UTF_8.decode(concatenate);
                System.out.printf("Item: %s%n%n", decode);
                return decode;
            }).then();
}
0reactions
vhvb1989commented, Oct 3, 2019

Closing this for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Data Collection Methods in Business Analytics - HBS Online
Data collection is the methodological process of gathering information about a specific subject. Here are 7 methods to leverage in business ...
Read more >
Create a simple select query - Microsoft Support
On the Create tab, in the Queries group, click Query Wizard. In the New Query dialog box, click Simple Query Wizard, and then...
Read more >
How to do Qualitative Analysis? 4 Simple Ways to ... - Granicus
How to do Qualitative Analysis? Follow these 4 simple steps for qualitative analysis to help you organise, code, explore & report on your...
Read more >
Data Loading: 3 Easy Methods - Learn | Hevo
This article gives a comprehensive guide on Data Loading component of an ETL process.
Read more >
Data Collection Methods - Jotform
The methods range from traditional and simple — such as a ... Qualitative data is one way to add context and reality to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found