Have you ever wanted to perform multiple HTTP requests in Java in parallel and wondered how to execute them in a non blocking fashion ? In this post we are going to explain how to execute them using a nonblocking RESTful API controller using the Spring WebFlux (Netty) framework with WebClient, based on Project Reactor
Nonblocking REST controller
It is necessary to use the Flux<> type to signify there is a list of items in the response
Spring Webflux Client
In our example, the Spring Webflux client returns a single string which represents an XML value. It uses a reactive stream using the Mono<> type. Its value is mapped to an object using Jackson. The three HTTP calls are then merged using the Flux.merge statement
Performance Comparison
The link below compares the performance of API requests performed using the Spring Webflux framework with WebClient versus DeferredResult or CompletableFuture with Servlet and a Blocking HTTP call with servlet
Are you looking for a professional Best SEO Services In Delhi Look no further. We specialize in providing high-quality, custom-made website designs for businesses of all sizes. Our team is experienced and knowledgeable, and we guarantee satisfaction with every project.
ReplyDelete