chapter eight

8 Reactive Spring Boot Application Development

 

This chapter covers

  • Introducing Reactive Programming with Spring Webflux
  • Developing Reactive RESTful APIs with annotated controller and Functional endpoints
  • Accessing Reactive RESTful APIs with WebClient
  • Developing Spring Boot applications with RSocket
  • Using WebSocket and Spring Boot to develop applications

In the previous chapter, we explored how to design and develop RESTful API with Spring Boot. Spring Framework offers an alternative technology stack with Spring WebFlux to develop reactive applications. Spring WebFlux which is based on Project Reactor offers utilities that lets you design reactive applications with controls such as non-blocking, backpressure and write code in a declarative manner. Besides, it provides the WebClient utility with a fluent API to consume the APIs.

In this chapter, we’ll look at RSocket and WebSocket protocols, which offers support for bi-directional communication between the communicating parties. Lastly, we’ll demonstrate how to use these protocols in a Spring Boot application. Let’s get started.

8.1 Introduction to Reactive Programming

Reactive programming is programming with asynchronous data streams. Let us understand the asynchronous data stream with a discussion of the terms asynchronous and data streams.

8.1.1 Backpressure

8.1.2 Benefits of Reactive Programming

8.2 Understanding Project Reactor

8.3 Introducing Spring WebFlux

8.4 Testing Reactive Applications

8.5 Introduction to RSocket

8.6 Introduction to WebSocket

8.7 Chapter Summary