Skip to content

Instantly share code, notes, and snippets.

@americanstone
Created February 13, 2018 18:26
Show Gist options
  • Save americanstone/b340e38d0e0b76ad42600da7616e09f6 to your computer and use it in GitHub Desktop.
Save americanstone/b340e38d0e0b76ad42600da7616e09f6 to your computer and use it in GitHub Desktop.
circuitBreaker.forceOpen

Want to know the behavoir of your app if a Hystrix Circuit is open?

Run with the circuit open

Run your spring cloud app with -Dhystrix.command.<circuitKeyName>.circuitBreaker.forceOpen=true

<circuiktKeyName> is the name of you hystrix circuit. If you used @HystrixCommand it is the name of the method. If you used @HystrixCommand(commandKey="mykey") is is the value of the commandKey attribute.

Dynamically force open the circuit

This can be accomplished using the Spring Cloud /env and /refresh actuator endpoints to dynamically set the property (examples using httpie, pronounced H T T Pie)

http --form POST :11060/env hystrix.command.findId.circuitBreaker.forceOpen=true
http --form POST :11060/refresh

Credit

This hystrix issue: Netflix/Hystrix#766

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment