Colleague Vishvesh implements Spring WebFlux for a clientPublished on: Author: Vishvesh Gowrising Category: News
Spring WebFlux: a framework that allows your application to perform better. But that’s not all it can do. Software Developer Vishvesh Gowrising had to learn the framework’s ins and outs for a client. And he was pleasantly surprised by the end result. In this blog, he will share his findings with you.
The client’s request was clear: communication between two REST-API servers without the communication blocking other functionalities. Software Developer Vishvesh Gowrising immediately started his research, looking for a framework that would fulfill the client’s wishes.
Vishvesh: “Spring RestTemplate used to be the way to make API requests to other servers, but nowadays this framework is deprecated. I encountered Spring WebClient as a replacement. Further research showed me the many advantages of Spring WebClient. While the RestTemplate made a blocking request to a webservice, the WebClient made a non-blocking request!”
After finding the right framework, Vishvesh had to learn what Spring WebFlux can do. Turns out: exactly what he was looking for. Vishvesh explains: “With Spring WebFlux, I can easily implement non-blocking webservices. After all, the framework is designed especially for a non-blocking web stack. It can handle concurrent requests with a small number of threads and easier scalability. WebFlux uses reactive programming techniques in synergy with its asynchronous paradigm to achieve this.”
But that’s not all. “It also supports uni- and bidirectional communication with other REST-API servers, which is exactly what the client needs,” says Vishvesh.
Built-in back pressure
Vishvesh was pleasantly surprised to learn that the framework also had built-in back pressure support. A useful functionality. Vishvesh explains: “Built-in back pressure deals with data streams that would otherwise be too large for the subscriber/requester to process. How does it do this? The built-in pressure buffers the excess data, then emits the data to the subscriber/requester. As long as they have the resources to process it.”
Implementing the framework
Now that Vishvesh had the solution, he needed to implement the framework. Keeping the client’s wishes in mind, Vishvesh got to work. “The client wanted communication between two REST-API servers that wouldn’t block any other functionalities. Therefore, it was important to implement communication that wouldn’t introduce a heavy load on the servers. Additionally, it was vital that the framework supplied callback functions if the request was (un)successful.”
A successful solution
The implementation was finally a success. Though the client’s project is still ongoing, the communication between both REST-API servers is done and already in production. Vishvesh: “The client was satisfied with the solution. They’re looking into further expanding communication between the servers. I’m already brainstorming about more implementations. I think the next step would be to push notifications about data updates between the servers.”
Vishvesh is positive about Spring WebFlux. He says: “The framework is perfect for developers who have servers with little resources. Or who want to make their web applications more efficient. It’s easy to implement and has really useful functionalities.”
Find out more
Curious how Spring WebFlux could work for your company? Or do you want to know more about Qualogy’s tailor-made solutions that will help you optimize your processes? Tell us about your challenge. You can contact us via email@example.com.