Hands-On Cloud:Native Microservices with Jakarta EE
上QQ阅读APP看书,第一时间看更新

Reactive programming

Reactive programming can be considered as the implementation of the guidelines that are defined in reactive systems. It is a programming model based on asynchronous data streams, oriented around the flows and propagation of data.

In reactive programming, the software must react to external stimuli, which are events that could be anything—variables, data structures, user inputs, caches, properties, and so on. These stimuli are called streams.

The names that are used to call the actors into reactive programming are related to the framework used to implement it.

In this chapter, we will try to quickly analyze the main Java frameworks that are able to implement a reactive system:

  •  RxJava
  •  Spring reactor
  •  Vert.x

For each framework, we will implement a simple example based on the Maven software project management tool. To try these examples, you need to have an IDE that enables Maven builds or have Maven installed in your workstation—follow the instructions described at https://maven.apache.org/install.html to do it.

Finally, we will quickly address how to make a Java EE monolith reactive, without rewriting the application through one of the frameworks we listed previously, but taking advantage of the latest asynchronous and messaging features made available by Java EE.