Skip to content

What does SimpleReact do?

johnmcclean-aol edited this page Feb 4, 2015 · 2 revisions

What does SimpleReact do?

SimpleReact allows you to easily construct highly concurrent, asynchronous, event-driven dataflows with a simple fluent Api. They are constructed under the hood from JDK 8 Streams of JDK 8 CompletableFutures where tasks are lambda's built with JDK 8 functional interfaces.

What does SimpleReact do in Plain English?

SimpleReact sets up multiple threads that move independently through user defined steps (using commands such as then, onFail, merge, peek, filter or capture). You can visualise it as something like this :-

Visualisation of a SimpleReact dataflow

The code to do that could look something like this :-

new SimpleReact().react(() -> makeRestCall(serviceA), () -> makeRestCall(serviceB), 
                            makeRestCall(serviceC))
                 .then( restResult -> convertToGreenSquare(restResult))
                 .then( GreenSquare input -> convertToOrangeCircle(input))
                 .then( OrangeCircle input -> convertToYellowTriangle(input))
                 .block(Collectors.toSet())
Clone this wiki locally