I have a function: Flux queryPerson() which queries database to generate the objects and return them in Flux. When I use .subscribe(), the app just run thru the code and exit. It doesn't wait for the results to come back for the query. But when I use .toStream() to block the stream, I can see the printouts. What am I doing wrong?
personRepository
.queryPerson()
.map(x -> x.getFirst().concat("ok"))
.subscribe(i -> System.out.println(i))
//.toStream().forEach(System.out::println)
;