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/e9250211 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e9250211 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e9250211 Branch: refs/heads/camel-2.19.x Commit: e92502113f0a10e90a2bee4051027847bedf3ee2 Parents: 750d7aa 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:30:06 2017 +0200 ---------------------------------------------------------------------- .../client/src/main/java/sample/camel/ClientRoute.java | 3 ++- .../client/src/main/resources/application.properties | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/e9250211/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/e9250211/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 87475ba..2918de6 100644 --- a/examples/camel-example-hystrix/client/src/main/resources/application.properties +++ b/examples/camel-example-hystrix/client/src/main/resources/application.properties @@ -15,4 +15,14 @@ # limitations under the License. # -server.port=8080 \ No newline at end of file +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