I have a class with the following two methods.
public class Test1 {
public Mono<String> blah1() {
Mono<String> blah = Mono.just("blah1");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("blah1 done");
return blah;
}
public Mono<String> blah2() {
Mono<String> blah = Mono.just("blah2");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("blah2 done");
return blah;
}
}
I have the following JUnit:
@Test
public void blah1Test() {
Flux<Tuple2<String, String>> s = Flux.zip(test1.blah1(), test1.blah2());
}
My result is as follows:
blah1 done
blah2 done
I expect blah2 to finish before blah1. Thus I believe this is processing blocking instead of non blocking. What do I need to do to have the output switch to blah2 done then blah1 done? Basically why are these not processing in parallel?
Thanks in advance for your time!