block()/blockFirst()/blockLast() are blocking error when calling bodyToMono AFTER exchange()

后端 未结 3 1133
忘了有多久
忘了有多久 2020-12-03 14:32

I am trying to use Webflux to stream a generated file to another location, however, if the generation of the file ran into an error, the api returns success, but with a DTO

3条回答
  •  忘掉有多难
    2020-12-03 14:52

    As stated in the most voted answer, one should never block. In my case, that is the only option as we are using a reactive library within an imperative piece of code. The blocking can be done by wrapping the mono in a processor:

    myMono.toProcessor().block()
    

提交回复
热议问题