deprecate CircuitBreakerProxy, #22198
This commit is contained in:
parent
ad4164d5e3
commit
e770287b01
4 changed files with 23 additions and 2 deletions
|
|
@ -7,8 +7,12 @@ This is an alternative implementation of the :ref:`Akka Circuit Breaker Pattern
|
|||
The main difference is that it is intended to be used only for request-reply interactions with an actor using the Circuit-Breaker as a proxy of the target one
|
||||
in order to provide the same failfast functionalities and a protocol similar to the circuit-breaker implementation in Akka.
|
||||
|
||||
.. warning::
|
||||
**Deprecation warning** - ``CircuitBreakerProxy`` has been deprecated and is scheduled for removal
|
||||
in the next major version. ``akka.pattern.CircuitBreaker`` with explicit ``ask`` requests can be used instead.
|
||||
|
||||
### Usage
|
||||
Usage
|
||||
-----
|
||||
|
||||
Let's assume we have an actor wrapping a back-end service and able to respond to ``Request`` calls with a ``Response`` object
|
||||
containing an ``Either[String, String]`` to map successful and failed responses. The service is also potentially slowing down
|
||||
|
|
@ -45,7 +49,8 @@ enabled by importing ``import akka.contrib.circuitbreaker.Implicits.futureExtens
|
|||
|
||||
.. includecode:: @contribSrc@/src/test/scala/akka/contrib/circuitbreaker/sample/CircuitBreaker.scala#ask-with-failure-sample
|
||||
|
||||
#### Direct Communication With The Target Actor
|
||||
Direct Communication With The Target Actor
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To send messages to the `target` actor without expecting any response you can wrap your message in a ``TellOnly`` or a ``Passthrough``
|
||||
envelope. The difference between the two is that ``TellOnly`` will forward the message only when in closed mode and
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import scala.util.{ Failure, Success }
|
|||
* This is an Actor which implements the circuit breaker pattern,
|
||||
* you may also be interested in the raw circuit breaker [[akka.pattern.CircuitBreaker]]
|
||||
*/
|
||||
@deprecated("Use akka.pattern.CircuitBreaker + ask instead", "2.5.0")
|
||||
object CircuitBreakerProxy {
|
||||
|
||||
/**
|
||||
|
|
@ -100,6 +101,7 @@ object CircuitBreakerProxy {
|
|||
|
||||
import akka.contrib.circuitbreaker.CircuitBreakerProxy._
|
||||
|
||||
@deprecated("Use akka.pattern.CircuitBreaker + ask instead", "2.5.0")
|
||||
final class CircuitBreakerProxy(
|
||||
target: ActorRef,
|
||||
maxFailures: Int,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import scala.language.implicitConversions
|
|||
|
||||
import scala.concurrent.{ ExecutionContext, Future }
|
||||
|
||||
@deprecated("Use akka.pattern.CircuitBreaker + ask instead", "2.5.0")
|
||||
sealed class OpenCircuitException(message: String) extends RuntimeException(message)
|
||||
private[circuitbreaker] final object OpenCircuitException extends OpenCircuitException("Unable to complete operation since the Circuit Breaker Actor Proxy is in Open State")
|
||||
|
||||
|
|
@ -19,6 +20,7 @@ private[circuitbreaker] final object OpenCircuitException extends OpenCircuitExc
|
|||
* `Future` result of an `ask` pattern to fail in case of
|
||||
* [[akka.contrib.circuitbreaker.CircuitBreakerProxy.CircuitOpenFailure]] response
|
||||
*/
|
||||
@deprecated("Use akka.pattern.CircuitBreaker + ask instead", "2.5.0")
|
||||
object Implicits {
|
||||
/**
|
||||
* Import this implicit to enable the methods `failForOpenCircuit` and `failForOpenCircuitWith`
|
||||
|
|
@ -61,6 +63,7 @@ object Implicits {
|
|||
* [[akka.contrib.circuitbreaker.CircuitBreakerProxy.CircuitOpenFailure]] failure responses throwing
|
||||
* an exception built with the given exception builder
|
||||
*/
|
||||
@deprecated("Use akka.pattern.CircuitBreaker + ask instead", "2.5.0")
|
||||
final class CircuitBreakerAwareFuture(val future: Future[Any]) extends AnyVal {
|
||||
@throws[OpenCircuitException]
|
||||
def failForOpenCircuit(implicit executionContext: ExecutionContext): Future[Any] = failForOpenCircuitWith(OpenCircuitException)
|
||||
|
|
@ -75,6 +78,7 @@ final class CircuitBreakerAwareFuture(val future: Future[Any]) extends AnyVal {
|
|||
}
|
||||
}
|
||||
|
||||
@deprecated("Use akka.pattern.CircuitBreaker + ask instead", "2.5.0")
|
||||
final class AskeableWithCircuitBreakerActor(val actorRef: ActorRef) extends AnyVal {
|
||||
def askWithCircuitBreaker(message: Any)(implicit executionContext: ExecutionContext, timeout: Timeout, sender: ActorRef = Actor.noSender): Future[Any] =
|
||||
internalAskWithCircuitBreaker(message, timeout, sender)
|
||||
|
|
@ -88,6 +92,7 @@ final class AskeableWithCircuitBreakerActor(val actorRef: ActorRef) extends AnyV
|
|||
}
|
||||
}
|
||||
|
||||
@deprecated("Use akka.pattern.CircuitBreaker + ask instead", "2.5.0")
|
||||
final class AskeableWithCircuitBreakerActorSelection(val actorSelection: ActorSelection) extends AnyVal {
|
||||
def askWithCircuitBreaker(message: Any)(implicit executionContext: ExecutionContext, timeout: Timeout, sender: ActorRef = Actor.noSender): Future[Any] =
|
||||
internalAskWithCircuitBreaker(message, timeout, sender)
|
||||
|
|
|
|||
|
|
@ -561,6 +561,15 @@ We also anticipate to replace the uses of Agents by the upcoming Akka Typed, so
|
|||
|
||||
If you use Agents and would like to take over the maintanance thereof, please contact the team on gitter or github.
|
||||
|
||||
|
||||
Contrib
|
||||
=======
|
||||
|
||||
CircuitBreakerProxy
|
||||
-------------------
|
||||
|
||||
:ref:`circuit-breaker-proxy` is deprecated in favor of ``akka.pattern.CircuitBreaker`` with explicit ``ask`` requests.
|
||||
|
||||
Akka Typed
|
||||
==========
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue