=str add Input/OutputStream mapMaterialized value warning in doc (#23424)

This commit is contained in:
Alexander Golubev 2017-07-27 11:48:34 +03:00 committed by Arnout Engelen
parent 3bad6da9a8
commit d004a32206

View file

@ -541,6 +541,24 @@ Sources and sinks for integrating with `java.io.InputStream` and `java.io.Output
`StreamConverters`. As they are blocking APIs the implementations of these stages are run on a separate
dispatcher configured through the `akka.stream.blocking-io-dispatcher`.
@@@ warning
Be aware that `asInputStream` and `asOutputStream` materialize `InputStream` and `OutputStream` respectively as
blocking API implementation. They will block tread until data will be available from upstream.
Because of blocking nature these objects cannot be used in `mapMaterializeValue` section as it causes deadlock
of the stream materialization process.
For example, following snippet will fall with timeout exception:
```scala
...
.toMat(StreamConverters.asInputStream().mapMaterializedValue { inputStream ⇒
inputStream.read() // this could block forever
...
}).run()
```
@@@
---------------------------------------------------------------
### fromOutputStream