Using cyclops-react 1.0.0-RC3, I tried to recreate the examples on the cyclops-react streams user guide with batching. I found that some methods were missing from ReactiveSeq
, including batchBySize
and windowByTime
.
I did find these methods on StreamUtils
and they worked as expected, but didn't look quite as slick as the examples in the user guide...
from user guide...
// Example 19. Batch by size example
ReactiveSeq.of(1,2,3,4,5, 6)
.map(n-> n==6? sleep(1) : n)
.batchBySize(4) // this function seems to be missing...
.toList()
what I could get working...
import com.aol.cyclops.control.ReactiveSeq;
// ...
StreamUtils.batchBySize(
ReactiveSeq.of(1, 2, 3, 4, 5, 6)
.map(n -> TestUtils.mayBeSlow(n)),
4)
.collect(Collectors.toList());
You can see my code in a working JUnit in the testBatchingSlidingWindowing
method test class StreamsTest.java
Should I expect to find the batchBySize
and windowByTime
on ReactiveSeq
or is using StreamUtils
the appropriate way?