Skip to content

Instantly share code, notes, and snippets.

@eldermoraes
Last active December 17, 2022 19:15
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
@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