API for pushing data asynchronously from a reactive-stream with non-blocking back pressure into a Scala Immutable List, using both cyclops-react and Reactor types.
1. cyclops-react types
LinkedListX<Integer> asyncScalaList = Spouts.reactive(Stream.of(1,2,3),Executors.newFixedThreadPool(1))
.map(this::asyncProcessing)
.to()
.linkedListX(LAZY)
.type(Scala.LIST)
.filter(this::targetValues);
//some processing while asyncScalaList is asyncrhonously populated
//extract underlying Scala List for use (blocking operation)
List<Integer> scalaList = asyncScalaList.to(ScalaConverters.List);
2. Similar code mixing Reactor and Scala collections
Flux<Integer> flux = Flux.of(1,2,3)
.subscribeOn(Executors.newFixedThreadPool(1)))
.map(this::asyncProcessing);
LinkedListX<Integer> asyncScalaList = Spouts.from(flux)
.to()
.linkedListX(LAZY)
.type(Scala.LIST)
.filter(this::targetValues);
//some processing while asyncScalaList is asyncrhonously populated
//extract underlying Scala List for use (blocking operation)
List<Integer> scalaList = asyncScalaList.to(ScalaConverters.List);
Example
API for pushing data asynchronously from a reactive-stream with non-blocking back pressure into a Scala Immutable List, using both cyclops-react and Reactor types.
1. cyclops-react types
2. Similar code mixing Reactor and Scala collections