=htc #19276 explain draining of entities is needed
This commit is contained in:
parent
984740198e
commit
2f762c995b
2 changed files with 35 additions and 1 deletions
|
|
@ -61,4 +61,21 @@ Example
|
|||
-------
|
||||
|
||||
.. includecode:: ../../code/docs/http/scaladsl/HttpClientExampleSpec.scala
|
||||
:include: single-request-example
|
||||
:include: single-request-example
|
||||
|
||||
|
||||
.. warning::
|
||||
Be sure to consume the response entities ``dataBytes:Source[ByteString,Unit]`` by for example connecting it
|
||||
to a ``Sink`` (for example ``response.entity.dataBytes.runWith(Sink.ignore)`` if you don't care about the
|
||||
response entity), since otherwise Akka HTTP (and the underlying Streams infrastructure) will understand the
|
||||
lack of entity consumption as a back-pressure signal and stop reading from the underlying TCP connection!
|
||||
|
||||
This is a feature of Akka HTTP that allows consuming entities (and pulling them through the network) in
|
||||
a streaming fashion, and only *on demand* when the client is ready to consume the bytes -
|
||||
it may be a bit suprising at first though.
|
||||
|
||||
There are tickets open about automatically dropping entities if not consumed (`#18716`_ and `#18540`_),
|
||||
so these may be implemented in the near future.
|
||||
|
||||
.. _#18540: https://github.com/akka/akka/issues/18540
|
||||
.. _#18716: https://github.com/akka/akka/issues/18716
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue