Multithread
By default if there is no delay, it will be running on single thread.
However we can specify publishOn()
or .parallel().runOn()
to specify the thread that we want
For example
flux.parallel().runOn(Schedulers.parallel()).subscribe(s -> {
System.out.println("s = " + s);
System.out.println("In thread s = " + Thread.currentThread().getId());
});
Or
flux.publishOn(Schedulers.parallel()).subscribe(s -> {
System.out.println("s = " + s);
System.out.println("In thread s = " + Thread.currentThread().getId());
});