Is there any issues with using WebClient for fetching responses from multiple REST APIs which are not reactive based.
Asked
Active
Viewed 4,236 times
1 Answers
2
Yes, you definitely can, and in fact, the use of WebClient is encouraged by Spring officially. Also, the RestTemplate which is generally the preferred way of communication for REST-based services has already been deprecated.
Also, there are no issues when using WebClient in a non-reactive context
However, you'll explicitly have to call subscribe
or block
when using WebClient in a non-reactive context.

Honza Zidek
- 9,204
- 4
- 72
- 118

isank-a
- 1,545
- 2
- 17
- 22
-
Thanks. So what all benefits are lost when using this way? compared to using webclient with a reactive API. – programmer Jul 30 '20 at 05:42
-
You do not lose any benefits of WebClient even when using it in a non-reactive environment. – isank-a Jul 30 '20 at 06:14
-
Isnt the async and non-blocking implementation only available in reactive world? This is why I asked. – programmer Jul 30 '20 at 11:03
-
1@Isank please read the part https://stackoverflow.com/help/how-to-ask about images, `DO NOT post images of code, data, error messages, etc. - copy or type the text into the question. Please reserve the use of images for diagrams or demonstrating rendering bugs, things that are impossible to describe accurately via text.` – Toerktumlare Jul 30 '20 at 15:54