Is it possible do read from a webflux flux in chunks? ( other than using delayElements )
For example after I write
Flux.range(1, 10).doOnNext(System.out::println).take(5).subscribe();
is there any way to continue to read the next 5 integers?
If not, is there an alternative for the consumer to decide when to request the next piece of data?
Edit:
To clarify, I would like to read the first 5 values, then pause until an arbitrary later time in the program, then read the next 5 values without recreating the emitter flux. simply calling buffer() won't do
then you need a full-fledged asynchronous subscriber object, not just a chain of methods.
In fact, it reads 5 items first, and then one by one after each call to
inp.remove(). If this is not exactly what you want, then you can extend classInpFlowto modify the policy when it invokesSubscription.request().Source codes are avalable at https://github.com/akaigoro/df4j (yes I am the author).