Sink.cancelled
Immediately cancel the stream
Signature
Description
Immediately cancel the stream
Example
In this example, we have a source that generates numbers from 1 to 5 but as we have used cancelled we get NotUsed
as materialized value and stream cancels.
- Scala
-
source
val source = Source(1 to 5) source.runWith(Sink.cancelled)
- Java
-
source
Source<Integer, NotUsed> source = Source.range(1, 5); NotUsed sum = source.runWith(Sink.cancelled(), system); return sum;
Reactive Streams semantics
cancels immediately
1.1.2