Looking for converting Flux to List<Object>
. Getting error if I use block(). So, need to conver without blocking calls.
Flux.from(Collection.find())
Using reactive programming, but graphql expects List<objects>
and erroring with returning Flux.
Code with Block()
public List<Test> findAll() {
return Flux.from(testCollection.find()).collectList().block();
}
Error :-
block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-kqueue-7
Here, I need to return List<Test>
as I can not send Flux<Test>
for some reason.
Flux
to aCollection
in a non-blocking fashion. There's ways around the issue - you could switch the flux to use a separate thread where blocking is allowed, you could call your graphql library in a subscriber chain, etc. - but it's difficult / impossible to tell which approach is best with a minimal reproducible example. – Treatise