简体   繁体   中英

Spring boot reactive WebClient calling legacy endpoint

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?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM