Reactive programming is a pretty hot trend these days, and its development is definitely worth following. There are different opinions on what reactive programming is, but the first thing worth mentioning is The Reactive Manifesto .
According to the manifesto, modern applications now have other, non-functional requirements, such as response time, availability, data volume, scalability, and fault tolerance, and they run in other environments, as cloud and containerization are very widespread.
When we use reactive programming, we build our application to respond to asynchronous streams of data. These streams of data can be events from the user, changes in the database, messages from other applications or (e.g.) IoT devices.
In order for the system to remain responsive, it is necessary to prevent these elements from arriving at such a rate that they flood the processing component (consumer), causing it to become overloaded, slow down, or even fail. One mechanism for this is back pressure, the ability to resist flooding. One type of this is non-blocking back pressure, which solves this protection by having the processing component request the next elements from the source of the elements (producer), and only as many as it can safely process, thereby preventing overload.
Reactive programming is typically used in a functional style (functional reactive programming (FRP)), where the basic unit is the function. It is characterized by being declarative, which makes it easier to read, maintain, and improve. This allows complex solutions to be created from small units and reusable operators.
This principle is programming language independent. There are several reactive frameworks available for most programming languages, and there are even frameworks that are available in most programming languages and can be used similarly (such as ReactiveX or Vert.X). These frameworks are also available in Java, but there are also additional implementations, such as Project Reactor, which is an implementation of Pivotal, the framework behind Spring.
The importance of reactive programming is also demonstrated by the fact that one of the biggest innovations of one of the most widespread and dynamically developing Java frameworks, Spring Framework 5, is a reactive web framework, Spring WebFlux. Its characteristic is that it enables asynchronous, non-blocking execution and functional programming, and similarly to frameworks proven on other platforms, the service is performed on a few reusable threads (event loop workers).
Project Reactor and Spring WebFlux are discussed in detail in the Advanced Spring Framework Tools training.
(The author, István Viczián, held a workshop on the topic at the 3rd National IT Competition Awards Ceremony, of which Training360 was a key supporter.)
