Reactive programming with Java 8 and simple-react : choosing a stream type

There are 3 Stream type in simple-react. The most powerful is LazyFutureStream, and the least feature rich is SimpleReactStream. EagerFutureStream lies somewhere in between.

SimpleReactStream is probably the easiest to use due to it’s more focused API. LazyFutureStream and EagerFutureStream are roughly on a par in terms of complexity, both support the SimpleReact api, the JDK api, JOOL Seq API and additional operators (LazyFutureStream does support infinite processing via iterators and generators which EagerFutureStream does not).

For now, more of the operators for LazyFutureStream are fully asynchronous than for EagerFutureStream. EagerFutureStream acts primarily as an extension of the model used in SimpleReactStream into the more powerful world of the LazyFutureStream. Nearly all operators for LazyFutureStream are asynchronous.

When you want maximum asynchronicity

Choose LazyFutureStream.

Almost all operations (where feasible) are asynchronous.

When you want similar behaviour to SimpleReactStream, but with more power

Choose EagerFutureStream.

EagerFutureStream starts processing immediately, but adds lots of powerful extra functionality, much of which operates asynchronously.

When you want simplicity

Choose SimpleReactStream.

Keep your code base simple and easy to understand for developers new to reactive programming.

LazyFutureStream or EagerFutureStream

More of the operators for LazyFutureStream are fully asynchronous, the core simple-react operators are all asynchronous for both (with the exception of flatMap for EagerFutureStream).

One significant advantage EagerFutureStream has is the ability to cancel an entire Stream right from the initial seed futures.

The Tutorial : Reactive programming with Java 8

Show your support

Clapping shows how much you appreciated John McClean’s story.