Transforming Streams
Map and filter flowing data.
Operators as Transformations
Akka Streams provides a rich set of operators on Source and Flow that mirror Scala's collection API but run asynchronously and respect backpressure.
Each operator returns a new blueprint, so transformations are composed declaratively before the stream ever runs.
map and filter
map applies a synchronous function to every element; filter drops elements that fail a predicate. These are the workhorses of element-wise transformation.
Both preserve ordering and propagate completion and failure downstream.
val flow =
Flow[Int]
.filter(_ % 2 == 0)
.map(n => n * n)All lessons in this course
- Source, Flow, and Sink
- Transforming Streams
- Backpressure
- Running a Pipeline