Skip to content

Instantly share code, notes, and snippets.

@spencergibb
Last active September 22, 2020 11:03
Show Gist options
  • Save spencergibb/82fc4faf6a54614a8b91 to your computer and use it in GitHub Desktop.
Save spencergibb/82fc4faf6a54614a8b91 to your computer and use it in GitHub Desktop.
Force a Spring Cloud Hystrix circuit to open

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

@InternetPseudonym
Copy link

@spencergibb - any way to force all open, forever?

hystrix.command.default.circuitBreaker.forceOpen

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