I am working on Schedulers in reactive streams and using a Flux and Scheduler on this Flux using the publishOn method as follows:
System.out.println("*********Calling Concurrency************");
List<Integer> elements = new ArrayList<>();
Flux.range(1, 1000)
.log()
.map(i -> i * 2)
.publishOn(Schedulers.parallel())
//.subscribeOn(Schedulers.parallel())
.subscribe(elements::add);
System.out.println("-------------------------------------");
for which i got the following info logs:
*********Calling Concurrency************
[info] | onSubscribe([Synchronous Fuseable] FluxRange.RangeSubscription)
[info] | request(256)
[info] | onNext(1)
[info] | onNext(2)
[info] | onNext(3)
[info] | onNext(4)
[info] | onNext(5)
[info] | onNext(6)
[info] | onNext(7)
[info] | onNext(8)
[info] | onNext(9)
.....
.....
[info] | onNext(444)
[info] | onNext(445)
[info] | onNext(446)
[info] | onNext(447)
[info] | onNext(448)
-------------------------------------
[info] | request(192)
.....
.....
[info] | onNext(999)
[info] | onNext(1000)
[info] | onComplete()
[info] | request(192)
and there is no information about the thread execution and processing. Also, sometimes 192 elements are requested and sometimes 256 elements are requested.
Here is the dependency which i am using:
<dependency>
<groupId>com.googlecode.slf4j-maven-plugin-log</groupId>
<artifactId>slf4j-maven-plugin-log</artifactId>
<version>1.0.0</version>
</dependency>
How can i get the log information about the current thread/parallel thread execution? Please suggest.