Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save blzjns/cade1b3be162103061e29bccb0b98167 to your computer and use it in GitHub Desktop.
Save blzjns/cade1b3be162103061e29bccb0b98167 to your computer and use it in GitHub Desktop.
Circuit Breaker Spotlight
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