=str add Input/OutputStream mapMaterialized value warning in doc (#23424)
This commit is contained in:
parent
3bad6da9a8
commit
d004a32206
1 changed files with 18 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue