Sink.cancelled
Immediately cancel the stream
Sink operators
Signature
Sink.cancelled
Sink.cancelled
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
copy source val source = Source ( 1 to 5 )
source . runWith ( Sink . cancelled )
Java
copy source Source < Integer , NotUsed > source = Source . range ( 1 , 5 );
NotUsed sum = source . runWith ( Sink . cancelled (), system );
return sum ;
Reactive Streams semantics
Found an error in this documentation? The source code for this page can be found
here .
Please feel free to edit and contribute a pull request.