CAMEL-11279: Updated hystrix example
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d72352b8 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d72352b8 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d72352b8 Branch: refs/heads/master Commit: d72352b8aff48f72b22ee11a663f168477127ccc Parents: c30e160 Author: Claus Ibsen <davscl...@apache.org> Authored: Tue May 16 12:26:51 2017 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue May 16 12:28:00 2017 +0200 ---------------------------------------------------------------------- .../client/src/main/java/sample/camel/ClientRoute.java | 3 ++- .../client/src/main/resources/application.properties | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/d72352b8/examples/camel-example-hystrix/client/src/main/java/sample/camel/ClientRoute.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-hystrix/client/src/main/java/sample/camel/ClientRoute.java b/examples/camel-example-hystrix/client/src/main/java/sample/camel/ClientRoute.java index 36a006f..c9f790d 100644 --- a/examples/camel-example-hystrix/client/src/main/java/sample/camel/ClientRoute.java +++ b/examples/camel-example-hystrix/client/src/main/java/sample/camel/ClientRoute.java @@ -25,10 +25,11 @@ public class ClientRoute extends RouteBuilder { @Override public void configure() { // you can configure the route rule with Java DSL here - from("timer:trigger?period=1s").streamCaching() + from("timer:trigger?period=500").streamCaching() .bean("counterBean") .log(" Client request: ${body}") .hystrix() + // see application.properties how hystrix is configured .to("http://localhost:9090/service1") //.onFallback() // we use a fallback without network that provides a repsonse message immediately http://git-wip-us.apache.org/repos/asf/camel/blob/d72352b8/examples/camel-example-hystrix/client/src/main/resources/application.properties ---------------------------------------------------------------------- diff --git a/examples/camel-example-hystrix/client/src/main/resources/application.properties b/examples/camel-example-hystrix/client/src/main/resources/application.properties index 44fdfe7..6dd33cf 100644 --- a/examples/camel-example-hystrix/client/src/main/resources/application.properties +++ b/examples/camel-example-hystrix/client/src/main/resources/application.properties @@ -16,3 +16,13 @@ ## --------------------------------------------------------------------------- server.port=8080 + +# configure hystrix +# when we have more than 5 requests per 10 seconds that 50%+ fails +# then open circuit and call fallback immediately +camel.hystrix.circuit-breaker-request-volume-threshold=5 +camel.hystrix.circuit-breaker-error-threshold-percentage=50 +camel.hystrix.metrics-rolling-percentile-window-in-milliseconds=10000 + +# hystrix logging +#logging.level.org.apache.camel.component.hystrix.processor=DEBUG