doOnFirst
Run the given function when the first element is received.
Signature
Source.doOnFirstSource.doOnFirst Flow.doOnFirstFlow.doOnFirst
Description
Run the given function when the first element is received.
Examples
- Scala
-
source
import org.apache.pekko import pekko.NotUsed import pekko.stream.scaladsl._ val source: Source[Int, NotUsed] = Source(1 to 10) val mapped: Source[Int, NotUsed] = source.doOnFirst(println)
Reactive Streams semantics
emits when upstream emits an element
backpressures when downstream backpressures
completes when upstream completes
1.3.0