Project Reactor supports the batching of stream elements (Flux<T>) in a couple of ways:
- Buffering elements into containers such as List, the result stream has the Flux<List<T>>type.
- Windowing elements into a stream of streams such as Flux<Flux<T>>. Note that, now, the stream signals not values but sub-streams, which we can process.
- Grouping elements by some key into a stream that has the type Flux<GroupedFlux<K, T>>. Each new key triggers a new GroupedFlux instance and all elements with that key are pushed through that instance of the GroupFlux class.
Buffering and windowing may happen based on the following:
- The number of processed elements; let's say every 10 elements
- Some time-span; let's say every 5 minutes ...