Last active
May 24, 2016 22:56
-
-
Save bibryam/99bec0dd0e46585eef3d6593126e8706 to your computer and use it in GitHub Desktop.
Camel Hystrix Circuit Breaker
This file contains hidden or 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
| 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