Is it possible for a non reactive Client (RestTemplate) to consume a Reactive REST API (WebFlux)
Asked Answered
M

1

7

Is it possible for a RestTemplate to consume an endpoint which is reactive based (Spring WebFlux)? I understand that the main idea of reactive programming is to avoid blocking and make better use of threads (eliminate thread per connection model) so what happens if my Client is non reactive?

  1. Will I still be able to call the service even if it is in a blocking manner?
  2. To achieve full reactiveness (non blocking) both Client and Server must be reactive?
Mahdi answered 14/11, 2021 at 0:33 Comment(0)
B
10
  1. Yes, that is not relevant to the clients of Reactive applications. The reason is that this is a regular HTTP call.
  2. Each may be fully reactive on its own. Having said that, if you use WebFlux in both Client and Server you will have a system that is as a whole reactive. But there is nothing forcing you to do this. You can have only one of the services as a Reactive application. It comes down to your needs and context.
Bice answered 14/11, 2021 at 0:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.