StreamConverters.asJavaStream

Create a sink which materializes into Java 8 Stream that can be run to trigger demand through the sink.

Additional Sink and Source converters

Signature

def asJavaStream[T](): Sink[T, java.util.stream.Stream[T]]

Description

Create a sink which materializes into Java 8 Stream that can be run to trigger demand through the sink. Elements emitted through the stream will be available for reading through the Java 8 Stream.

The Java 8 Stream will be ended when the stream flowing into this Sink completes, and closing the Java Stream will cancel the inflow of this Sink. Java Stream throws exception in case reactive stream failed.

Be aware that Java Stream blocks current thread while waiting on next element from downstream.

Reactive Streams semantics

cancels when the Java Stream is closed

backpressures when no read is pending on the Java Stream

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.