Monday, 2 February 2015

SimpleReact : Simple Functional Reactive Programming for Java 8

We (the very productive and small team I work with here in Aol) have just released a very lightweight functional reactive programming library for Java 8. It builds entirely on pre-existing JDK 8 libraries (so functional interfaces, Streams, CompletableFuture) and makes it very easy to create asynchronous reactive dataflows.

Getting started

Getting started is as simple as setting up a basic Reactive flow such as the following and evolving from there -
 List<String> strings = new SimpleReact()
            .<Integer> react(() -> 1, () -> 2, () -> 3)
            .then(it -> it * 100)
            .then(it -> "*" + it)

This will result in a list, that looks something like this :

Although not necessarily in that order. All the work will be done asynchronously, and the block() method blocks the current thread until all the work is complete (& blocking the current thread is optional). See more examples on the SimpleReact wiki .

Adding SimpleReact as a dependency

SimpleReact is available on Maven Central.


compile group: '', name:'simple-react', version:'0.1'



No comments:

Post a Comment