-
-
Save blzjns/cade1b3be162103061e29bccb0b98167 to your computer and use it in GitHub Desktop.
Circuit Breaker Spotlight
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.pattern.CircuitBreaker | |
val breaker = | |
CircuitBreaker(system.scheduler, | |
maxFailures = 5, | |
callTimeout = 10.seconds, | |
resetTimeout = 1.minute) | |
def dangerous: Future[String] = | |
breaker.withCircuitBreaker(Future(dangerousCall)) | |
def dangerousCall: String = | |
"This really isn't that dangerous" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment