pekko/akka-docs/rst/java/http/routing-dsl/directives/future-directives/onCompleteWithBreaker.rst
Konrad Malawski fe47d596bc +doc add java example for onCompleteWithBreaker (#20675)
* +doc #20198 add java example for onCompleteWithBreaker

* =doc fix sphinx warnings
2016-06-01 10:31:50 +02:00

19 lines
762 B
ReStructuredText

.. _-onCompleteWithBreaker-java-:
onCompleteWithBreaker
=====================
Description
-----------
Evaluates its parameter of type ``CompletionStage<T>`` protecting it with the specified ``CircuitBreaker``.
Refer to :ref:`Akka Circuit Breaker<circuit-breaker>` for a detailed description of this pattern.
If the ``CircuitBreaker`` is open, the request is rejected with a ``CircuitBreakerOpenRejection``.
Note that in this case the request's entity databytes stream is cancelled, and the connection is closed
as a consequence.
Otherwise, the same behaviour provided by :ref:`-onComplete-java-` is to be expected.
Example
-------
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/FutureDirectivesExamplesTest.java#onCompleteWithBreaker