Last active
December 17, 2022 19:15
-
-
Save eldermoraes/f239294539d40d07a1282c2e93fd3227 to your computer and use it in GitHub Desktop.
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