Reactive programming and Java EE

Reactive programming lets your code be called instead of calling your code. You can visualize it as being event-based instead of procedural. Here is an example to compare both the styles:

public void processData(Data data) {    if (validator.isValid(data)) {        service.save(data);        return data;    }    throw new InvalidDataException();}

This is a very simple and common implementation of a business method where we call two services: validator and service. The first one will validate the data by checking whether it exists in the database, the values are in the expected ranges, and so on, while the second one will actually process the updates (a database, for instance).

The issue with this style is that the data validation ...

Get Java EE 8 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.