FutureStream is a powerful lazy, asynchronous, parallel stream particularly well suited to performing blocking I/O operations. Get started by creating and configuring an instance of the Stream builder LazyReact.
e.g. to load, process and save a large number of files in parallel, we can use cyclops-futurestream like so..
new LazyReact(10,10).of(arrayOfFilenames)
.map(this::loadFiles)
.map(this::processData)
.map(this::saveFiles)
.run();
Other features in this module include
- StreamSource : for creating 'pushable' JDK Streams - Streams you can push new data into
- SimpleReact : an easy to use, eager FutureStream
- Pipes : for plumbing together your asynchronous parallel futurestreams
FutureStream - parallel / async Streaming
new LazyReact(100,100).generate(()->"data") //100 active tasks, 100 threads
.map(d->"produced on " + Thread.currentThread().getId())
.peek(System.out::println)
.map(this::process)
.flatMap(e->ReactiveSeq.range(0,e))
.run();
type | description | characteristics |
---|---|---|
FutureStream | Asynchronous and parallel stream | Lazy, async, parallel, Reactive |
SimpleReact | Asynchronous bulk operations on Futures | Eager async |
LazyReact | Builder for FutureStreams | |
Pipes | Event bus for managing data transfer via Adapters to connected data structures | Async |
type | description | characteristics |
---|---|---|
StreamSource | A factory class for 'pushable' JDK Streams |
- LazyFutureStream overview : A powerful API for infinite parallel Streaming
- SimpleReactStream overview : an easy to use API for finite eager parellel Streaming
- Stream type overview
- LazyFutureStream & reactive-streams
- A simple API (simple-react) and a rich api (LazyFutureStream
- Asynchronous terminal operations
- Batching, time control, sharding, zipping
- onFail
- Event based : forEachWithError etc
- For comprehensions
- Retry
- Take, Skip and Sample
- Scheduling
- getting started
- error handling
- filter /map/ reduce /flatMap
- choosing a stream type
- stream creation
- pooling reactors
- pull / push model
- flow control
- batching and chunking
- sharding
- zipping streams
- firstOf, anyOf, allOf
- stream operations
- sequence operations
- Getting started example
- Building a non-blocking NIO Rest Client
- Bulk loading files
- Converting examples from RxJava
- Implementing a data cache
- Implementing a Quorum
- Reacting to asynchronous events with a Stream of CompletableFutures
- Selecting the fastest algorithm
- Asynchronous fun with Vert.x
- JDBC Processing
- Understanding LazyFutureStreams behavior
- Quick overview of SimpleReactStream
- Understanding the push-pull model of FutureStreams
- Let the illusion die Build your own FutureStreams
- FutureStream comparison matrix : note EagerFutureStream is discontinued
- React pools - elastic thread pools
- Fine Tuning SimpleReact
- Sharing a forkJoinPool with Parallel Streams - info purposes, don't do this!
- Separating task executors
- Working with Primitives Directly
- Optimizing cyclops-react Streams
- Fast Futures and Fast Future Pooling : Fast Futures ~2.5 faster than CompletableFutures in LazyFutureStreams
- StreamSource for pushable Streams
- Pushing data into Java 8 Streams - blog entry