Using a reactive API client
We have a RESTful API, now it’s time to use it in a non-blocking fashion. We’ll create a reactive RESTful API that calls another RESTful API.
In this recipe, we’ll create a reactive application that consumes an API. We’ll learn how to use the reactive WebClient to perform requests to the target RESTful API.
Getting ready
In this recipe, we’ll consume the application created in the Creating a reactive RESTful API recipe. If you haven’t completed it yet, I prepared a working version that you can use as a starting point for this recipe. You can find it on the book’s GitHub repository at https://github.com/PacktPublishing/Spring-Boot-3.0-Cookbook, in the chapter8/recipe8-2/start
folder.
You can run the target project and keep it for the rest of the recipe.
How to do it...
We’ll create an efficient consumer application for our RESTful API:
- First, we’ll create a new application...