-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
area/gen4Possible research theme for Reactor 4Possible research theme for Reactor 4status/on-holdThis was set aside or cannot be worked on yetThis was set aside or cannot be worked on yet
Milestone
Description
In current version of Reactor ( 3.2.1.RELEASE ), this code will do request(100) (because of eager prefetch):
Flux.range(0, Integer.MAX_VALUE)
.hide()
.log("producer")
.concatMap(Mono::just, 100)
.log("subscriber")
.subscribe(new Subscriber<>() {
@Override
public void onSubscribe(Subscription s) {
}
@Override
public void onNext(Integer integer) {
}
@Override
public void onError(Throwable t) {
}
@Override
public void onComplete() {
}
});
// 11:25:40.166 INFO --- producer : onSubscribe(FluxHide.HideSubscriber)
// 11:25:40.182 INFO --- subscriber : onSubscribe(FluxConcatMap.ConcatMapImmediate)
// 11:25:40.184 INFO --- producer : request(100)Suggestion:
Optional prefetch mode, LAZY|EAGER. If it is LAZY, there will be no prefetch unless downstream does it's first request.
Motivation:
While it's ok for most of use cases, it might be a big issue when the publisher is some IO source (e.g. Kafka, RSocket, etc), where requesting before the subscriber is ready to consume is a waste of resources and might affect the startup time of the app if there are some global publishers (e.g. message processing)
lanwen, OlegDokuka, wutzebaer, cenkakin, Nullpo and 2 more
Metadata
Metadata
Assignees
Labels
area/gen4Possible research theme for Reactor 4Possible research theme for Reactor 4status/on-holdThis was set aside or cannot be worked on yetThis was set aside or cannot be worked on yet