watch
Watch a specific ActorRef
and signal a failure downstream once the actor terminates.
Signature
Description
Watch a specific ActorRef
and signal a failure downstream once the actor terminates. The signaled failure will be an WatchedActorTerminatedException
.
Example
An ActorRef
can be can be watched and the stream will fail with WatchedActorTerminatedException
when the actor terminates.
- Scala
-
source
val ref: ActorRef = someActor() val flow: Flow[String, String, NotUsed] = Flow[String].watch(ref).recover { case _: WatchedActorTerminatedException => s"$ref terminated" }
- Java
Reactive Streams semantics
emits when upstream emits
backpressures when downstream backpressures
completes when upstream completes