+doc,htc #18610 document using singleRequest in Actors

This commit is contained in:
Konrad Malawski 2015-09-30 12:07:03 +02:00
parent f9909d79ab
commit 452bbe03fe
4 changed files with 97 additions and 16 deletions

View file

@ -44,8 +44,13 @@ request's effective URI.
Just like in the case of the super-pool flow described above the request must have either an absolute URI or a valid
``Host`` header, otherwise the returned future will be completed with an error.
.. includecode:: ../../code/docs/http/javadsl/HttpClientExampleDocTest.java#single-request-example
Example
-------
Using the Future-Based API in Actors
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When using the ``Future`` based API from inside an ``Actor``, all the usual caveats apply to how one should deal
with the futures completion. For example you should not access the Actors state from within the Future's callbacks
(such as ``map``, ``onComplete``, ...) and instead you should use the ``pipe`` pattern to pipe the result back
to the Actor as a message:
.. includecode:: ../../code/docs/http/javadsl/HttpClientExampleDocTest.java#single-request-example
.. includecode:: ../../code/docs/http/javadsl/HttpClientExampleDocTest.java#single-request-in-actor-example