Sinks
Introduction to Sinks
Explore the role of `Sink<A, In, L, E, R>` in stream processing. Learn how a `Sink` consumes elements, handles errors, produces values, and manages leftover elements. Use it seamlessly with `Stream.run` for efficient stream processing.
Read more
Creating Sinks
Learn how to construct powerful sinks for processing stream elements. Explore common constructors like `head`, `last`, `count`, `sum`, `take`, `drain`, `timed`, `forEach`, and discover how to create sinks from success and failure. Dive into collecting strategies using `collectAll`, `collectAllToSet`, `collectAllToMap`, `collectAllN`, `collectAllWhile`, `collectAllToSetN`, `collectAllToMapN`, folding techniques with `foldLeft`, `fold`, `foldWeighted`, `foldUntil`, and more.
Read more
Sink Operations
Explore sink operations to transform or filter their behavior. Learn to adapt sinks for different input types using `Sink.mapInput`. Discover how `Sink.dimap` allows complete conversion between input and output types. Utilize `Sink.filterInput` to selectively process elements based on specific conditions.
Read more
Parallel Operators
Explore parallel operations like `Sink.zip` for combining results and `Sink.race` for racing concurrent sinks. Learn how to run multiple sinks concurrently, combining or selecting the first to complete. Enhance task performance by executing operations simultaneously.
Read more
Leftovers
Explore handling unconsumed elements with sinks. Learn to collect or ignore leftovers using `Sink.collectLeftover` and `Sink.ignoreLeftover`. Efficiently manage and process remaining elements from upstream sources in data streams.
Read more