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.
The doOnFirst operator adheres to the ActorAttributes.SupervisionStrategy attribute. On Supervision.Resume the failing first element is dropped and the function is not retried; on Supervision.Restart the next element is treated as the first.
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
2.0.0-M3+142-ba462fb3*