This file contains 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
@Path("/circuit") | |
public class CircuitResource { | |
@Timeout(unit = ChronoUnit.MILLIS, value = 500) | |
@Fallback(fallbackMethod = "fallback") | |
@CircuitBreaker(requestVolumeThreshold = 4, failureRatio = 0.5, delay = 2000, delayUnit = ChronoUnit.MILLIS, successThreshold = 2) | |
@GET | |
public String getCircuit() throws InterruptedException { | |
Thread.sleep(600); | |
return "Circuit \n"; | |
} | |
private String fallback(){ | |
return "I'm a fallback "; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment