4
votes

In a Spring Boot (2.2.2.RELEASE) application, I have reactive endpoints (returning Mono or Flux), each of them is using reactive WebClient for calling another service. This "other" service is legacy (non-reactive) one.

Here is my question:

  • Is there a benefit of using Webflux (reactive WebClient) if my reactive endpoint is calling this non-reactive endpoint which does blocking stuff?

  • Is my reactive endpoint still reactive?

2

2 Answers

2
votes

If we're talking about HTTP endpoints, we can call them with blocking or non-blocking (asynchronous) clients, but not fully reactive.

If your "new" application is reactive, you have to use non-blocking client (WebClient in your case), otherwise you will block NIO-threads and loose all the advantages of the reactive approach. The fact that the “other” application is blocking doesn't matter, you can still get a less resource-intensive "new" application.

1
votes

They are 1. Not fully. 2. Your request is not full reactive until you change legacy APIs

Explanation: End-to-End Reactive pattern only help into to the performance side Currently you’re using reactive client this helps to connect to server in two way communication. First set of APIs are reactive so web server layer is now reactive but data layer (Legacy APIs ) not reactive