Skip to content

Instantly share code, notes, and snippets.

@bibryam
Last active May 24, 2016 22:56
Show Gist options
  • Select an option

  • Save bibryam/99bec0dd0e46585eef3d6593126e8706 to your computer and use it in GitHub Desktop.

Select an option

Save bibryam/99bec0dd0e46585eef3d6593126e8706 to your computer and use it in GitHub Desktop.
Camel Hystrix Circuit Breaker
public class ClientRoute extends RouteBuilder {
@Override
public void configure() {
from("timer:trigger?period=1s")
.log(" Client request: ${body}")
.hystrix()
.to("http://localhost:9090/service1")
// use onFallback() to provide a repsonse message immediately: .transform().simple("Fallback ${body}")
// use onFallbackViaNetwork() when there is a 2nd service call
.onFallbackViaNetwork()
.to("http://localhost:7070/service2")
.end()
.log("Client response: ${body}");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment